[issue7902] relative import broken

2010-08-16 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

Btw, the comment and failure message in r81380/r81381 look wrong.

-# If absolute import syntax is used, then do not try to perform
-# a relative import in the face of failure.
+# If explicit relative import syntax is used, then do not try
+# to perform an absolute import in the face of failure.

 self.fail(explicit relative import triggered 
-  an implicit relative import)
+  an implicit absolute import)


In addition the TestCase.assertRaises method could be used:

def test_absolute_import_without_future(self):
# If explicit relative import syntax is used, then do not try
# to perform a relative import in the face of failure.
# Issue #7902.
with self.assertRaises(ImportError):
from .os import sep
self.fail(explicit relative import triggered an 
  implicit absolute import)

--
nosy: +flox

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7902
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7902] relative import broken

2010-08-16 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

Comment changed in r84097, 3.2 branch, with minor fixes.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7902
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7902] relative import broken

2010-08-16 Thread Barry A. Warsaw

Barry A. Warsaw ba...@python.org added the comment:

Guido has spoken: 
http://mail.python.org/pipermail/python-dev/2010-August/103104.html

We'll keep the change for 2.6.6rc2.

--
nosy: +barry
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7902
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7902] relative import broken

2010-08-16 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

Merged in 3.1 with r84115.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7902
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7902] relative import broken

2010-08-14 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Backporting this change to 2.6 has created an incompatibility in that branch, 
see for example issue9600. Apparently, it will only break code that is 
conceptually wrong, but still worked on 2.6.

I'll suggest that this is a release-critical issue for 2.6.6. It should be 
considered whether the incompatibility is accepted, or fixed, or reverted.

--
nosy: +loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7902
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7902] relative import broken

2010-08-14 Thread Martin v . Löwis

Changes by Martin v. Löwis mar...@v.loewis.de:


--
priority: normal - release blocker
status: closed - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7902
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7902] relative import broken

2010-05-19 Thread Meador Inge

Meador Inge mead...@gmail.com added the comment:

Does this patch seem reasonable?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7902
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7902] relative import broken

2010-05-19 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
assignee:  - brett.cannon
keywords: +needs review
stage:  - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7902
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7902] relative import broken

2010-02-12 Thread Oren Held

Changes by Oren Held o...@held.org.il:


--
nosy: +Oren_Held

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7902
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7902] relative import broken

2010-02-10 Thread ganges master

New submission from ganges master gangesmas...@users.sourceforge.net:

the relative-import mechanism is broken... at least on python2.6 but i'd guess 
on later versions as well.

consider this package layout:
/tmp/foo/
/tmp/foo/__init__.py
/tmp/foo/bar.py

where bar.py is:
# note this is a relative import and should fail!
from .os import walk
print walk
# and this should also fail
from . import os
print os

running it yields a bug:

$ PYTHONPATH=/tmp python
Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1] on linux2
Type help, copyright, credits or license for more information.
 import foo.bar
function walk at 0xb7d2aa04  #  ?!?!
Traceback (most recent call last):
  File stdin, line 1, in module
  File /tmp/foo/bar.py, line 4, in module
from . import os
ImportError: cannot import name os


from . import os fails as expected, but from .os import walk works -- 
although it should obviously fail too.


-tomer

--
components: Interpreter Core
files: bar.py
messages: 99176
nosy: gangesmaster
severity: normal
status: open
title: relative import broken
versions: Python 2.6
Added file: http://bugs.python.org/file16201/bar.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7902
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7902] relative import broken

2010-02-10 Thread ganges master

ganges master gangesmas...@users.sourceforge.net added the comment:

i believe brett is in charge of this, adding him to the noisy. sorry if it's 
not you :)

--
nosy: +brett.cannon

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7902
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7902] relative import broken

2010-02-10 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

So doing the import manually through __import__('os', globals(), locals(), 
['walk'], 1) does not work. My guess is it has something to do with the 
IMPORT_FROM opcode (or something related), but I don't have time right now to 
dig deeper.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7902
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com