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: Patch to 742342 Crash on recursive reload
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: collinwinter Nosy List: bleair2, collinwinter, georg.brandl, loewis
Priority: normal Keywords: patch

Created on 2004-03-24 04:17 by bleair2, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Patch_742342.diff bleair2, 2004-03-24 04:17 diff to add modules_reloading dict to intepreter
reload.patch collinwinter, 2007-03-12 00:24 Updated reload() patch by Collin Winter
Messages (7)
msg45649 - (view) Author: Brian Leair (bleair2) Date: 2004-03-24 04:17
Modules that causes a recursive reload cause a program 
abort. Easy for python developer to fix in their code, but the 
python interpreter shouldn't crash.
This patch guards against circular reloading. This protection 
comes by an additional dictionary stored in the interpreter 
state to keep trakc of modules that are reloading. Recursive 
imports are protected against in a similar manner
msg45650 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-03-06 14:53
Can you please also provide a test suite change to demonstrate the problem?
msg45651 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2007-03-12 00:24
I've updated this patch to a recent SVN revision and worked up a test case.

What do you think, Martin?
File Added: reload.patch
msg45652 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-03-12 12:21
The failure I see is not an interpreter crash, but an ImportError. Is that what everybody else sees also, or does it really fault the interpreter?

If that is the bug to be fixed, the patch looks fine, please apply. There is one line that uses space rather than tab; that should be corrected before committing.
msg45653 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-03-12 12:53
With a file "foo.py" containing "import foo; reload(foo)", the interpreter segfaults here (linux x86).
With the patch, it doesn't anymore.
msg45654 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-03-12 14:28
Interesting. My system was OSX/x86.
msg45655 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2007-03-12 16:50
Applied as r54291 (trunk), r54294 (release25-maint). Thanks for the patch, Brian!
History
Date User Action Args
2022-04-11 14:56:03adminsetgithub: 40072
2004-03-24 04:17:00bleair2create