Ray.Allen <ysj....@gmail.com> added the comment:

I guess it's the problem with lib2to3/fixes/fix_urllib.py. Indentation is not 
taken into consideration when fix "import". Fix it with indentation taken into 
consideration maybe a little complex, but here is a simple and ugly fix: when 
one import statement was transformed to two or more statement, use 
semicolon(';') instead of '\n' as separator, between many import statements. In 
this case, the 
"""
def fun():
    from urllib import urlopen, urlencode
"""

is transformed in to:

"""
def fun():
    from urllib.request import urlopen;from urllib.parse import urlencode
"""

It will takes time to work out a better fix.

----------
nosy: +ysj.ray
Added file: http://bugs.python.org/file18227/lib2to3.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9386>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to