Marc-Andre Lemburg added the comment:

On 02.12.2015 21:29, Serhiy Storchaka wrote:
> 
> Serhiy Storchaka added the comment:
> 
>> I think all we need to do is add a .__reduce__()
>> method to StreamWriter and StreamReader, which then
>> raises a PickleError.
> 
> Rather TypeError. Yes, it is the least that we should to do in maintained 
> releases. If codecs_stream_delegating_2.patch is considered too drastic for 
> bugfix. But this can be only a part of problem. May be there are issues with 
> other optional special methods. And adding __reduce_ex__ breaks subclass 
> pickleability if it was implemented with __getstate__ and __getnewargs__.
> 
> Here is a patch for this way.

Thanks. I think using __reduce__ instead of __reduce_ex__ is
safer, since subclasses will more likely override __reduce__
than __reduce_ex__.

The other approach will have too many backwards incompatible side
effects, e.g. the repr() over StreamReader instances would change.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6395>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to