Issue1006

classification
Title: __import__ fromlist doesn't get processed
Type: behaviour Severity: urgent
Components: Core Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pjenvey Nosy List: pjenvey, tristan
Priority: urgent Keywords:

Created on 2008-03-07.04:42:19 by tristan, last changed 2008-03-08.05:54:20 by pjenvey.

Messages
msg3065 (view) Author: Tristan King (tristan) Date: 2008-03-07.04:42:18
when using __import__ with a fromlist, the modules in fromlist should be
added to the imported module's __dict__. It doesn't.

Example:

$ mkdir a
$ mkdir a/b
$ mkdir a/b/c
$ touch a/__init__.py
$ touch a/b/__init__.py
$ touch a/b/c/__init__.py
$ python -c "print __import__('a.b', {}, {}, ('c',)).c"
<module 'a.b.c' from 'a/b/c/__init__.pyc'>
tristan@quiver:~/projects/tmp/test$ jython -c "print __import__('a.b',
{}, {}, ('c',)).c"
Traceback (innermost last):
  File "<string>", line 1, in ?
AttributeError: 'module' object has no attribute 'c'
msg3066 (view) Author: Philip Jenvey (pjenvey) Date: 2008-03-07.06:15:44
This was broke by my r4188 when I removed the getattr on a module 
automatically triggering an import (which is more correct). it exposed a 
bug in __import__ -- it totally ignores the fromlist =[

>>> __import__('a.b',{}, {}, ('c',))
<module 'a.b' from 'a/b/__init__.py'>
>>> assert 'a.b.c' in sys.modules
Traceback (innermost last):
  File "<console>", line 1, in ?
AssertionError:
msg3071 (view) Author: Philip Jenvey (pjenvey) Date: 2008-03-08.05:54:20
fixed in r4193
History
Date User Action Args
2008-03-08 05:54:21pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg3071
2008-03-07 06:35:14pjenveysetpriority: urgent
2008-03-07 06:15:45pjenveysetassignee: pjenvey
messages: + msg3066
severity: major -> urgent
nosy: + pjenvey
2008-03-07 04:42:19tristancreate