You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by "Nigel B (JIRA)" <ji...@apache.org> on 2018/09/05 01:11:00 UTC
[jira] [Commented] (LIBCLOUD-1011) A unicode string is not an
instance of basestring on Python 2.7.5
[ https://issues.apache.org/jira/browse/LIBCLOUD-1011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16603799#comment-16603799 ]
Nigel B commented on LIBCLOUD-1011:
-----------------------------------
[Line 152 in utils/py3|https://github.com/apache/libcloud/blob/trunk/libcloud/utils/py3.py#L152] seems to be the problem.
In Python2,
{{>>> basestring = unicode = str}}
{{>>> foo = u'unicode'}}
{{>>> isinstance(foo, basestring)}}
{{False}}
That is exactly the behavior that's the cause of this bug.
> A unicode string is not an instance of basestring on Python 2.7.5
> -----------------------------------------------------------------
>
> Key: LIBCLOUD-1011
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-1011
> Project: Libcloud
> Issue Type: Bug
> Components: Core
> Environment: Python 2.7.5 on Centos 7.
> Reporter: Nigel B
> Priority: Major
>
> I've run into a problem with basestring defined in libcloud.utils.py3 for python. It does not recognize unicode as an instance of basestring. That doesn't sound right.
>
> Here's terminal output from a machine where I can consistently reproduce this issue.
>
> {{$ python}}
> {{Python 2.7.5 (default, Aug 4 2017, 00:39:18)}}
> {{[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2}}
> {{Type "help", "copyright", "credits" or "license" for more information.}}
> {{>>> foo = u'my-unicode-string'}}
> {{>>> isinstance(foo, basestring)}}
> {{True}}
> {{>>> from libcloud.utils.py3 import basestring}}
> {{/srv/softserve/env/lib/python2.7/site-packages/libcloud/utils/py3.py:60: UserWarning: Missing backports.ssl_match_hostname package}}
> {{ warnings.warn("Missing backports.ssl_match_hostname package")}}
> {{>>> isinstance(foo, basestring)}}
> {{False}}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)