[issue8221] 2to3 mishandles StringIO inside a package with an io.py module

2010-03-24 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

This should be fixed in the latest versions of 2to3.

--
nosy: +benjamin.peterson
resolution:  -> out of date
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8221] 2to3 mishandles StringIO inside a package with an io.py module

2010-03-24 Thread Robert Kern

New submission from Robert Kern :

When a module inside a package imports StringIO from cStringIO, it should 
change that to "from io import StringIO". However, if there is a module inside 
the package named io.py, 2to3 changes it to "from .io import StringIO".

[bug23]$ tree
.
`-- package
|-- __init__.py
|-- helper.py
`-- io.py

1 directory, 3 files

[bug23]$ cat package/helper.py
from cStringIO import StringIO

[bug23]$ 2to3 package 
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
--- package/helper.py (original)
+++ package/helper.py (refactored)
@@ -1,1 +1,1 @@
-from cStringIO import StringIO
+from .io import StringIO
RefactoringTool: Files that need to be modified:
RefactoringTool: package/helper.py

--
components: 2to3 (2.x to 3.0 conversion tool)
messages: 101636
nosy: Robert.Kern
severity: normal
status: open
title: 2to3 mishandles StringIO inside a package with an io.py module
versions: Python 2.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com