[issue13272] 2to3 fix_renames doesn't rename string.lowercase/uppercase/letters

Ezio Melotti report at bugs.python.org
Thu Oct 27 09:27:05 CEST 2011


New submission from Ezio Melotti <ezio.melotti at gmail.com>:

$ cat deleteme.py 
from string import lowercase, uppercase, letters
print uppercase == 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
print lowercase == 'abcdefghijklmnopqrstuvwxyz'
print letters == 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
$ python deleteme.py 
True
True
True
$ 2to3 -w deleteme.py 
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: Refactored deleteme.py
--- deleteme.py (original)
+++ deleteme.py (refactored)
@@ -1,4 +1,4 @@
 from string import lowercase, uppercase, letters
-print uppercase == 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-print lowercase == 'abcdefghijklmnopqrstuvwxyz'
-print letters == 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+print(uppercase == 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
+print(lowercase == 'abcdefghijklmnopqrstuvwxyz')
+print(letters == 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
RefactoringTool: Files that were modified:
RefactoringTool: deleteme.py
$ python3 deleteme.py 
Traceback (most recent call last):
  File "deleteme.py", line 1, in <module>
    from string import lowercase, uppercase, letters
ImportError: cannot import name lowercase

They should be renamed to ascii_*.

----------
components: 2to3 (2.x to 3.0 conversion tool)
messages: 146475
nosy: benjamin.peterson, ezio.melotti
priority: normal
severity: normal
stage: test needed
status: open
title: 2to3 fix_renames doesn't rename string.lowercase/uppercase/letters
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13272>
_______________________________________


More information about the Python-bugs-list mailing list