Issue2259

classification
Title: Relative, star imports ("from .module import *") broken with "from __future__ import absolute_import"
Type: Severity: normal
Components: Core Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jeff.allen Nosy List: Arfrever, fwierzbicki, jeff.allen, tkanerva, zyasoft
Priority: Keywords:

Created on 2015-01-21.23:59:21 by Arfrever, last changed 2015-05-24.07:28:16 by jeff.allen.

Messages
msg9438 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2015-01-21.23:59:21
This problem is absent without "from __future__ import absolute_import".

$ cd /tmp
$ mkdir test
$ touch test/__init__.py
$ echo $'from __future__ import absolute_import\nfrom . import *' > test/x.py
$ echo $'from __future__ import absolute_import\nfrom .z import *' > test/y.py
$ touch test/z.py
$ tree test
test
├── __init__.py
├── x.py
├── y.py
└── z.py

0 directories, 4 files
$ cat test/x.py
from __future__ import absolute_import
from . import *
$ cat test/y.py
from __future__ import absolute_import
from .z import *
$ python2.7 -c 'import test.x'
$ python2.7 -c 'import test.y'
$ jython2.7 -c 'import test.x'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "test/x.py", line 2, in <module>
    from . import *
ValueError: Empty module name
$ jython2.7 -c 'import test.y'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "test/y.py", line 2, in <module>
    from .z import *
ImportError: No module named z
$
msg9997 (view) Author: Jeff Allen (jeff.allen) Date: 2015-05-03.20:11:21
Turns out to be a duplicate of #2158, currently fixed on my local repo:

> type test\x.py
from __future__ import absolute_import
from . import *
> type test\y.py
from __future__ import absolute_import
from .z import *
> type test\z.py
#
> type test\__init__.py
#
> %jt%\dist\bin\jython -c"import test.x"

> %jt%\dist\bin\jython -c"import test.y"

>
msg10075 (view) Author: Jeff Allen (jeff.allen) Date: 2015-05-24.07:28:15
Fixed at: https://hg.python.org/jython/rev/9483b3252bd5
History
Date User Action Args
2015-05-24 07:28:16jeff.allensetstatus: open -> closed
resolution: fixed
messages: + msg10075
2015-05-03 20:11:21jeff.allensetmessages: + msg9997
2015-05-03 11:53:23jeff.allensetassignee: jeff.allen
nosy: + jeff.allen
2015-01-22 00:49:54Arfreversetcomponents: + Core
2015-01-21 23:59:21Arfrevercreate