Author vstinner
Recipients pitrou, vstinner
Date 2019-05-27.16:02:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1558972939.59.0.0574927539507.issue37054@roundup.psfhosted.org>
In-reply-to
Content
Multiple tests log an "Exception ignored", but all of them come from the Python implementation.

The problem is that _pyio.BytesIO and _pyio.TextIOWrapper initialize their self._buffer and self._seekable attribute "later" in the constructor, but then expect these attribute to exist in __del__().

Example:

>>> import _pyio; _pyio.BytesIO(b'data', foo=b'fat')

Exception ignored in: <function IOBase.__del__ at 0x7f1874c5c550>
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 409, in __del__
    self.close()
  File "/home/vstinner/prog/python/master/Lib/_pyio.py", line 903, in close
    self._buffer.clear()
AttributeError: 'BytesIO' object has no attribute '_buffer'

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got an unexpected keyword argument 'foo'

BytesIO.__init__() is not even called.

An easy fix would be to do nothing in __del__() if hasattr(self, '_buffer') if false.
History
Date User Action Args
2019-05-27 16:02:19vstinnersetrecipients: + vstinner, pitrou
2019-05-27 16:02:19vstinnersetmessageid: <1558972939.59.0.0574927539507.issue37054@roundup.psfhosted.org>
2019-05-27 16:02:19vstinnerlinkissue37054 messages
2019-05-27 16:02:19vstinnercreate