-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Bug in InteractiveConsole /pickle #53189
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
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__)... |
The current behavior is reasonable. This is rather a documentation issue than a bug in InteractiveInterpreter or pickle. We can clarify this explicitly since it is not obvious. |
… pickle (GH-123069) Co-authored-by: Terry Jan Reedy <[email protected]>
…ion to pickle (pythonGH-123069) (cherry picked from commit a31bbc9) Co-authored-by: Serhiy Storchaka <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]>
…ion to pickle (pythonGH-123069) (cherry picked from commit a31bbc9) Co-authored-by: Serhiy Storchaka <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]>
…tion to pickle (GH-123069) (GH-134328) gh-53189: Document peculiarities of InteractiveConsole in relation to pickle (GH-123069) (cherry picked from commit a31bbc9) Co-authored-by: Serhiy Storchaka <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]>
…tion to pickle (GH-123069) (GH-134329) gh-53189: Document peculiarities of InteractiveConsole in relation to pickle (GH-123069) (cherry picked from commit a31bbc9) Co-authored-by: Serhiy Storchaka <[email protected]> Co-authored-by: Terry Jan Reedy <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
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:
Linked PRs
The text was updated successfully, but these errors were encountered: