New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in InteractiveConsole /pickle #53189
Comments
Unable to pickle classes used in the InteractiveConsole. The code attached works in python 2.5 and fails on python 3.1.2. |
Yes, the problem is observed in py3k. Pickle module when used via Interactive console is trying to import the class as __console__.ClassName and it is failing to see the __console__ module. _pickle.PicklingError: Can't pickle <class '__console__.Example'>: import of module '__console__' failed |
One easy fix for this would be to make InteractiveConsole use the string "__main__" instead of "__console__". But other than that, I don't think we can fix this within pickle. |
Bug stills on branch doing some gdb on 3.2, I have discovered that the problem occurs when trying to dump global Example from module __console__ on py3k/Modules/_pickle.c:save_global:2536 Python 2.7 never calls save_global (why?) in annex: an update test |
preliminary gdb backtrace |
Well, this is a pickle problem or a Interactive console problem? on python 2.7 does not save a type "type" (like Example class is) on python 3.2 does and when saving a type, it tries to save a global. |
I'd suggest this is an issue in the doc for the InteractiveInterpreter class. Try locals=global() and your problem goes away. (namespace == __main__)... |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: