[Python-Dev] Bug in 2to3 concerning import statements?
Greg Ewing
greg.ewing at canterbury.ac.nz
Sat Apr 30 21:22:56 EDT 2016
More information about the Python-Dev mailing list
Sat Apr 30 21:22:56 EDT 2016
- Previous message (by thread): [Python-Dev] Convert int() to size_t in Python/C
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
It seems that 2to3 is a bit simplistic when it comes to
translating import statements. I have a module GUI.py2exe
containing:
import py2exe.mf as modulefinder
2to3 translates this into:
from . import py2exe.mf as modulefinder
which is a syntax error.
It looks like 2to3 is getting confused by the fact that
there is both a submodule and a top-level module here
called py2exe. But the original can only be an absolute
import because it has a dot in it, so 2to3 shouldn't be
translating it into a relative one.
Putting "from __future__ import absolute_import" at the
top fixes it, but I shouldn't have to do that, should I?
--
Greg
- Previous message (by thread): [Python-Dev] Convert int() to size_t in Python/C
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list