[Python-Dev] Standardize error message for non-pickleable types
Serhiy Storchaka
storchaka at gmail.com
Mon Oct 29 15:38:49 EDT 2018
When you try to to pickle or copy a non-pickleable object, you will get
an error. In most cases this will be a TypeError with one of few
similar, but different variants:
"can't pickle XXX objects" (default)
"Cannot serialize XXX object" (socket, BZ2Compressor, BZ2Decompressor)
"can not serialize a 'XXX' object" (buffered files in _pyio)
"cannot serialize 'XXX' object" (FileIO, TextWrapperIO, WinConsoleIO,
buffered files in _io, LZMACompressor, LZMADecompressor)
"cannot serialize {} object" (proposed for SSLContext)
Perhaps some of them where added without deep thinking and then were
replicated in different places. I'm going to replace all of them with a
standardized error message. But I'm unsure what variant is better.
1. "pickle" or "serialize"?
2. "can't", "Cannot", "can not" or "cannot"?
3. "object" or "objects"?
4. Use the "a" article or not?
5. Use quotes around type name or not?
Please help me to choose the best variant.
More information about the Python-Dev
mailing list