[issue6395] Infinite Recursion during Unpickling a codecs Object

2015-12-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There is also a problem with deepcopying: >>> class MemReader: ... def __init__(self, data): ... self.buf = memoryview(data).cast('B') ... def read(self, size=-1): ... if size < 0: ... size = len(self.buf) ... res =

[issue6395] Infinite Recursion during Unpickling a codecs Object

2015-12-02 Thread Marc-Andre Lemburg
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

[issue6395] Infinite Recursion during Unpickling a codecs Object

2015-12-02 Thread Serhiy Storchaka
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 conside

[issue6395] Infinite Recursion during Unpickling a codecs Object

2015-12-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Added tests for pickling and deepcopying. -- Added file: http://bugs.python.org/file41215/codecs_stream_delegating_2.patch ___ Python tracker _

[issue6395] Infinite Recursion during Unpickling a codecs Object

2015-12-02 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 02.12.2015 20:16, Serhiy Storchaka wrote: > > Serhiy Storchaka added the comment: > >> If the StreamWriter/Reader cannot pickle the underlying stream (which is >> probably always the case), why should the object itself be pickleable ? > > io.BytesIO() a

[issue6395] Infinite Recursion during Unpickling a codecs Object

2015-12-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > If the StreamWriter/Reader cannot pickle the underlying stream (which is probably always the case), why should the object itself be pickleable ? io.BytesIO() and io.StringIO() are pickleable. -- ___ Python tracke

[issue6395] Infinite Recursion during Unpickling a codecs Object

2015-11-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Implementing only .__get/setstate__() doesn't fix all problem. We have implement also __getnewargs_ex__(). But implemented __getnewargs_ex__() has priority over __getnewargs__() implemented in subclasses. And may be there are problems with other optional spe

[issue6395] Infinite Recursion during Unpickling a codecs Object

2015-11-28 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- keywords: +patch Added file: http://bugs.python.org/file41184/codecs_stream_delegating.patch ___ Python tracker ___ __

[issue6395] Infinite Recursion during Unpickling a codecs Object

2013-03-28 Thread Georg Brandl
Changes by Georg Brandl : -- versions: +Python 3.3, Python 3.4 -Python 3.2 ___ Python tracker ___ ___ Python-bugs-list mailing list Uns

[issue6395] Infinite Recursion during Unpickling a codecs Object

2009-07-08 Thread ThomasH
ThomasH added the comment: Sounds good to me. The main intention of this bug is not to make codecs objects pickleable by all means (I don't know if this would be sensible and/or possible), but at least to have them degrade gracefully during pickling, particularly without infinite recursion. I've