Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with unicode type on Python 2 #1

Open
mr-rodgers opened this issue Jun 4, 2016 · 0 comments
Open

Doesn't work with unicode type on Python 2 #1

mr-rodgers opened this issue Jun 4, 2016 · 0 comments
Assignees
Labels

Comments

@mr-rodgers
Copy link
Owner

mr-rodgers commented Jun 4, 2016

The commit ed2632b introduced a change that breaks unicode scope items on Python 2:

>>> u'user' in ScopeList([u'user'])
[snipped]
  File "scopelist.py", line 139, in <genexpr>
    return all(o in self for o in item)
  File "scopelist.py", line 138, in __contains__
    if not isinstance(item, str) and isinstance(item, Iterable):
  File "C:\Dev\py\env27\lib\abc.py", line 132, in __instancecheck__
    if subclass is not None and subclass in cls._abc_cache:
  File "C:\Dev\py\env27\lib\_weakrefset.py", line 75, in __contains__
    return wr in self.data
RuntimeError: maximum recursion depth exceeded in cmp

It seems that takes a unicode type as an iterable of scope items, and doesn't make a special case for it as it does for str.

As part of the fix for this, the entire module should probably be updated to work correctly with unicode rather than str. That would include switching to unicode literals (which Python 3.3 and later support) and maybe rejecting bytes types outright, even on Python 2.

@mr-rodgers mr-rodgers added the bug label Jun 4, 2016
@mr-rodgers mr-rodgers self-assigned this Jun 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant