-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
Pickling is losing some fields on exceptions #103333
Comments
Why don't values like name/obj appear in |
It looks very related to #73652 |
I think its the same overall problem, but i'm not really fit to come up with the be-all-end-all solution to the problem for all exceptions and their fields. (Which is where that issues seems to point). For now I'd like to just try to fix this for AttributeError (if that's ok)... i've raised #103352 if you could check it. |
* Pickle the `name` and `args` attributes of AttributeError when present. Co-authored-by: Gregory P. Smith <greg@krypto.org> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Thanks for the contribution, merged! I'm considering this a feature and doing it for 3.12 only as it can be seen as an API enhancement otherwise so doing this mid-cycle in 3.11 unless it were a regression from past releases doesn't feel right. @sobolevn is right that there is a larger all Exceptions issue that could be dealt with, but this is still a meaningful improvement in the interim. |
Bug report
Say we have an AttributeError with some fields on it (like name). When we pickle and unpickle it, we can see that .name (at least) is lost (and set to None). Optimally those fields should still be in-tact on the unpickled instance.
Your environment
Same thing seems to happen on 3.10.7 and 3.11.3 as well.
Linked PRs
The text was updated successfully, but these errors were encountered: