]> granicus.if.org Git - python/commit
SF patch #471839: Bug when extensions import extensions (Shane Hathaway)
authorGuido van Rossum <guido@python.org>
Tue, 16 Oct 2001 20:07:34 +0000 (20:07 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 16 Oct 2001 20:07:34 +0000 (20:07 +0000)
commitae9e7960d33d9d2c2f63f5611fc808db293c2ed5
tree82de45b4caf4ae51603fefe7076bca9d91dadfe6
parentb6aca6afe2c46b57810c0f3e726e6dae5336d324
SF patch #471839: Bug when extensions import extensions (Shane Hathaway)

    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.
Python/importdl.c