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 ). 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 ). Now they are not needed.
Current error messages for different classes: "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) Yest one error message is proposed by PR 6099 in 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?