-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Remove Py2 'str' type #6374
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
Remove Py2 'str' type #6374
Conversation
Remove legacy code that dealt with the mixed Py2 string types. Keep recognising the names in (legacy) code. Closes cython#1370 Closes cython#5854
The first two commits are loosely related and just happened along the way. |
if name == 'long' and language_level == 2: | ||
def lookup(self, name, language_level=None): | ||
# 'language_level' is passed by ModuleScope | ||
if name == 'unicode' or name == 'basestring': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how useful it is to map basestring
to anything. In that if I've got some legacy code with ininstance(something, basestring)
I'd expect it to match either str
or bytes
in Python 3.
I don't think it's worth the effort of making it work, but I also don't know if it's worth keeping around an incorrect mapping that only does half of what it should.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basestring
always mapped to only str
in Py3. It only included bytes
in Py2, because that used to be str
there.
I kept the name purely to avoid breaking existing code that uses it correctly. It might be worth adding a warning about the usage, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough - if it's been that way for a while then it probably makes sense to keep it like that.
@da-woods are you generally ok with a change of this size and effect? It's somewhat mitigated by keeping |
Yeah - seems like the right time to do it I think. |
I think this was the last major brick for Cython 3.1. Let's see what else wants to go in before we can release the first alpha. |
Closes #1370
Closes #5854