[Patches] [ python-Patches-471839 ] Bug when extensions import extensions

noreply@sourceforge.net noreply@sourceforge.net
Tue, 16 Oct 2001 13:01:21 -0700


Patches item #471839, was opened at 2001-10-16 12:49
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=471839&group_id=5470

Category: Core (C code)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Shane Hathaway (hathawsh)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: Bug when extensions import extensions

Initial Comment:
When an extension imports another extension in its
initXXX() function, the variable _Py_PackageContext is
prematurely reset to NULL.  If the outer extension then
calls Py_InitModule(), the extension is installed in
sys.modules without its package name.  The
manifestation of this bug is a "SystemError:
_PyImport_FixupExtension: module <package>.<extension>
not loaded".

To fix this, importdl.c just needs to retain the old
value of _Py_PackageContext and restore it after the
initXXX() method is called.  The attached patch does this.

This patch applies to Python 2.1.1 and the current CVS.



----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=471839&group_id=5470