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: reloading imported modules sometimes fail with 'parent not in sys.modules' error
Type: Stage:
Components: Interpreter Core Versions: Python 3.0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: _doublep, christian.heimes
Priority: normal Keywords: patch

Created on 2007-11-03 16:51 by _doublep, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
reloading-fix.diff _doublep, 2007-11-03 16:51
Messages (3)
msg57085 - (view) Author: Paul Pogonyshev (_doublep) Date: 2007-11-03 16:51
This is apparently because sys.modules contains Unicode (str) keys,
while 'parentname' is an old-style string.  Attached patch seems to fix
it, but I have no idea if it is correct in principle
msg57095 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-11-04 12:10
Why are you using PyUnicode_AsUTF32String(parentname)?
PyUnicode_AsString() is the correct method (although it's not yet in the
docs).

The rest looks fine. PyModule_GetName() returns a char* from
PyUnicode_AsString(). Fixed in r58838.
msg57096 - (view) Author: Paul Pogonyshev (_doublep) Date: 2007-11-04 12:30
Thank you for the commit.

I just had a problem with my package, and since I was not sure if it was
a bug in Py3k or the package, I went to debugging the former and found
this.  I just didn't know how to work with Unicode strings properly.
History
Date User Action Args
2022-04-11 14:56:27adminsetgithub: 45720
2008-01-06 22:29:45adminsetkeywords: - py3k
versions: Python 3.0
2007-11-04 12:30:48_doublepsetmessages: + msg57096
2007-11-04 12:10:35christian.heimessetstatus: open -> closed
keywords: + py3k
resolution: fixed
messages: + msg57095
nosy: + christian.heimes
2007-11-03 17:30:39loewissetkeywords: + patch
2007-11-03 16:51:43_doublepcreate