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
2to3 fails to convert types.StringTypes appropriately #58146
Comments
test_types.py converts "types.StringTypes" to "str" - but types.StringTypes is a tuple, so expressions like "type(x) in type.StringTypes" fails after conversion with "TypeError: argument of type 'type' is not iterable" Attaching a fix and test. Note that the fixer still seems "strange" after this fix - types.StringType gets converted to "bytes" but types.StringTypes uses str. This means the expression "type.StringType in type.StringTypes" evaluates to True in 2.x but False once converted - however, that should probably be tackled in a different bug - the fact the expression now causes a TypeError once converted is more blatantly wrong and the focus of this bug. |
A short patch LGTM. Can we have a commit review please. |
New changeset b97b6cc381d7 by Robert Collins in branch 'default': |
I've applied this to 3.6. |
Looking at the audit log its not clear to me which versions Benjamin wanted this applied to, though it looks like 2.7 at least. |
Not clear to me either: I figured that after three years the relevance to 2.7 was pretty low, but I can transplant it if you think thats relevant. |
Well, it's a patch to 2to3, which I'm assuming is sometimes (often?) run using 2.7 to convert code to run under python3. I personally don't use transplant in cases like this, I just apply the patch independently to the 2.7 branch. That may just be because I've never used transplant, but we are treating the two branches as independent and I don't want to screw that up :) |
So, I don't think I've ever done 2.x stuff with hg here, I'll leave this open till I've looked up the docs and applied it safely. ... unless you'd like to do the 2.7 application ? :) |
New changeset ce34c78ebf65 by Robert Collins in branch '2.7': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: