[issue2446] 2to3 translates "import foobar" to "import .foobar" rather than "from . import foobar"

David Wolever report at bugs.python.org
Fri Mar 28 20:19:37 CET 2008


David Wolever <wolever at cs.toronto.edu> added the comment:

Can you write a test case proving this?

At the moment, the second thing that the transform function in  
fix_import.py does is return if the import doesn't look like a local  
import (see probably_a_local_import in fix_import).

At the moment, all (with an exception or two) of the import test  
cases test both cases -- the local import exists and the local import  
does not exist -- automatically.

On 28-Mar-08, at 3:04 PM, Collin Winter wrote:

>
> Collin Winter <collinw at gmail.com> added the comment:
>
> The problem with the "fix" in r61755 is that it doesn't distinguish
> between stdlib and non-stdlib imports: "import os" becomes "from .
> import os", which is clearly wrong.
>
> __________________________________
> Tracker <report at bugs.python.org>
> <http://bugs.python.org/issue2446>
> __________________________________

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2446>
__________________________________


More information about the Python-bugs-list mailing list