You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
reloading imported modules sometimes fail with 'parent not in sys.modules' error #45720
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2007-11-04.12:10:35.123>created_at=<Date2007-11-03.16:51:43.161>labels= ['interpreter-core']
title="reloading imported modules sometimes fail with 'parent not in sys.modules' error"updated_at=<Date2008-01-06.22:29:45.414>user='https://bugs.python.org/doublep'
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
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.
Activity
doublep commentedon Nov 3, 2007
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
tiran commentedon Nov 4, 2007
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.
doublep commentedon Nov 4, 2007
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.