This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: imp.new_module does not function correctly if the module is returned from a function and used directly
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Stop purging modules which are garbage collected before shutdown
View: 18214
Assigned To: Nosy List: Arfrever, benjamin.peterson, jkp, pitrou, terry.reedy
Priority: normal Keywords:

Created on 2009-10-15 11:24 by jkp, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
testcase.py jkp, 2009-10-15 11:24 Testcase demonstrating the issue.
testcase.py jkp, 2009-10-15 11:34
Messages (7)
msg94082 - (view) Author: Jamie Kirkpatrick (jkp) Date: 2009-10-15 11:24
See the testcase included.  If you instead assign the result of the 
get_module() call to a variable and then make the call to the function 
defined in that module it works as expected.
msg94083 - (view) Author: Jamie Kirkpatrick (jkp) Date: 2009-10-15 11:34
Updated the testcase to show that the __dict__ for the module is incorrect 
unless the module is assigned to a temp variable.
msg94095 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-10-15 15:45
Fixed in r75437.
msg118480 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-10-12 22:58
Rebroken in r85392. See #10068.
msg118819 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-10-15 18:40
Since that revision only touched py3k, I am guessing that it only broke 3.2.
msg121213 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2010-11-15 01:51
But there were r85393 (2.7) and r85394 (3.1).
msg193992 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-07-31 09:36
Work in progress in issue 18214.
History
Date User Action Args
2022-04-11 14:56:54adminsetgithub: 51389
2013-07-31 09:36:01pitrousetstatus: open -> closed

nosy: + pitrou
messages: + msg193992

superseder: Stop purging modules which are garbage collected before shutdown
resolution: duplicate
2010-11-15 01:51:49Arfreversetnosy: + Arfrever

messages: + msg121213
versions: + Python 3.1, Python 2.7
2010-10-15 18:40:42terry.reedysetnosy: + terry.reedy

messages: + msg118819
versions: + Python 3.2, - Python 2.6, Python 2.5
2010-10-12 22:58:22benjamin.petersonsetstatus: closed -> open
resolution: fixed -> (no value)
messages: + msg118480
2009-10-15 15:45:25benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg94095

resolution: fixed
2009-10-15 11:34:07jkpsetfiles: + testcase.py

messages: + msg94083
2009-10-15 11:24:51jkpcreate