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
Improve standard error for uncopyable types #77319
Comments
Currently most extension types are not pickleable and copyable. The default error messages is "can't pickle XXX objects". This is confusing in case of copying because not all know that copying falls back to the pickle protocol (see for example bpo-33023). The proposed PR changes the default error messages to more neutral "cannot serialize 'XXX' object". This or similar error messages are already used in some classes (files, sockets, compressors/decompressors). It also removes __getstate__ methods raising an error from non-pickleable extension types. They where added when extension types were pickleable by default (fixed in bpo-22995). Now they are not needed. |
Current error messages for different classes: "can't pickle XXX objects" (default) Yest one error message is proposed by PR 6099 in bpo-33023 for SSLContext: "cannot serialize {} object" PR 6239 replaces them with unified "cannot serialize 'XXX' object" which already is used in some extension classes. This is the most popular error message except the default error message. I'm not sure this is the best error message. "can't"/"Cannot"/"cannot"/"can not", using an article and quotes -- what is better? |
Does anybody have opinion about this issue? Is this option the best of possible? I'm going to merge the PR soon. |
Changed to "cannot pickle 'XXX' object" after discussing on Python-Dev: https://mail.python.org/pipermail/python-dev/2018-October/155599.html |
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: