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: cPickle does relative import
Type: Stage:
Components: Extension Modules Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, georg.brandl, gvanrossum
Priority: normal Keywords:

Created on 2002-12-26 15:23 by gvanrossum, last changed 2022-04-10 16:06 by admin. This issue is now closed.

Messages (3)
msg60298 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-12-26 15:23
save_global() in cPickle calls PyImport_ImportModule()
to import the module of a global that's about to be
pickled, in order to check whether the given name in
fact refers to the given object.

But when it is invoked from code living inside a
package, PyImport_ImportModule() first tries a relative
import, and if by sheer accident that relative import
succeeds, it performs the wrong test.

Example: in a package that has a submodule
"exceptions", pickling instances of built-in exceptions
will attempt to look up the exception class name in the
exceptions submodule rather than in the built-in
toplevel module by that name.
msg71507 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-08-20 02:50
Is this still an issue?
msg85745 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-04-07 20:31
Probably, but I guess nobody is really interested in fixing it since
it's not in 3.x.
History
Date User Action Args
2022-04-10 16:06:03adminsetgithub: 37649
2010-04-29 17:56:06terry.reedysetstatus: pending -> closed
2009-04-07 20:31:52georg.brandlsetstatus: open -> pending

nosy: + georg.brandl
messages: + msg85745

resolution: wont fix
2008-08-20 02:50:48benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg71507
2002-12-26 15:23:39gvanrossumcreate