New submission from chen-y0y0 <cyy144...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue46636>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to