[New-bugs-announce] [issue10926] Some Invalid Relative Imports succeed in Py 3.0 & 3.1 [& correctly fail in 3.2rc1]
Mark Summerfield
report at bugs.python.org
Mon Jan 17 15:28:45 CET 2011
New submission from Mark Summerfield <mark at qtrac.eu>:
I'm reporting this at Georg Brandl's suggestion.
If you unpack the attached (tiny) tarball you get this directory structure:
Graphics/
Graphics/Xpm.py
Graphics/Vector/
Graphics/Vector/__init__.py
Graphics/Vector/Svg.py
Graphics/__init__.py
The Svg.py file has this content:
#!/usr/bin/env python3
from ..Graphics import Xpm
SVG = 1
Here are 3 interactive actions, one each for 3.0, 3.1, and 3.2rc1:
$ python30
Python 3.0.1 (r301:69556, Jul 15 2010, 10:31:51)
[GCC 4.4.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from Graphics.Vector import *
>>> Svg.SVG
1
$ python31
Python 3.1.2 (r312:79147, Jul 15 2010, 10:56:05)
[GCC 4.4.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from Graphics.Vector import *
>>> Svg.SVG
1
$ ~/opt/python32rc1/bin/python3
Python 3.2rc1 (r32rc1:88035, Jan 16 2011, 08:32:59)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from Graphics.Vector import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "Graphics/Vector/Svg.py", line 2, in <module>
from ..Graphics import Xpm
ImportError: No module named Graphics
So clearly 3.0 and 3.1 have the same behavior as each other; and this is different from 3.2rc1, and Georg says that 3.0 and 3.1 have a bug and that 3.2rc1 is correct.
PS R. David Murray suggests that this might be related to
http://bugs.python.org/issue7902
----------
components: Interpreter Core
files: py-import-bug.tar.gz
messages: 126399
nosy: mark
priority: normal
severity: normal
status: open
title: Some Invalid Relative Imports succeed in Py 3.0 & 3.1 [& correctly fail in 3.2rc1]
type: behavior
versions: Python 3.1, Python 3.2
Added file: http://bugs.python.org/file20424/py-import-bug.tar.gz
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10926>
_______________________________________
More information about the New-bugs-announce
mailing list