This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients ThomasH, alexandre.vassalotti, lemburg, serhiy.storchaka
Date 2015-12-06.12:10:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1449403819.84.0.210889673458.issue6395@psf.upfronthosting.co.za>
In-reply-to
Content
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 = bytes(self.buf[:size])
...         self.buf = self.buf[size:]
...         return res
...     def close():
...         pass
...     def __deepcopy__(self, memo):
...         return MemReader(self.buf)
...     def __reduce__(self):
...         return MemReader, (bytes(self.buf),)
... 
>>> import codecs, copy
>>> s1 = codecs.getreader('utf-8')(MemReader(b'abcd'))
>>> s2 = copy.deepcopy(s1)
>>> s1.read()
'abcd'
>>> s2.read()
b'abcd'
>>> s2
<__main__.MemReader object at 0xb701988c>
History
Date User Action Args
2015-12-06 12:10:20serhiy.storchakasetrecipients: + serhiy.storchaka, lemburg, alexandre.vassalotti, ThomasH
2015-12-06 12:10:19serhiy.storchakasetmessageid: <1449403819.84.0.210889673458.issue6395@psf.upfronthosting.co.za>
2015-12-06 12:10:19serhiy.storchakalinkissue6395 messages
2015-12-06 12:10:19serhiy.storchakacreate