[New-bugs-announce] [issue46636] Bugs of 2to3

chen-y0y0 report at bugs.python.org
Fri Feb 4 09:49:36 EST 2022


New submission from chen-y0y0 <cyy144881 at icloud.com>:

I have a file named foo.py:
try :
    input = raw_input
    int = long
    chr = unichr
    range = xrange
except NameError :
    pass

When I process this file to 2to3, it shows:
--- foo.py (original)
+++ foo.py (refactored)
@@ -1,7 +1,7 @@
 try :
     input = raw_input
-    int = long
-    chr = unichr
+    int = int
+    chr = chr
     range = xrange
except NameError :
    pass
RefactoringTool: Files that need to be modified:
RefactoringTool: foo.py

I don't know why it modifies the Python 2.x and 3.x compatible code.

----------
components: 2to3 (2.x to 3.x conversion tool)
messages: 412508
nosy: prasechen
priority: normal
severity: normal
status: open
title: Bugs of 2to3
type: behavior
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46636>
_______________________________________


More information about the New-bugs-announce mailing list