Author vstinner
Recipients pitrou, vstinner
Date 2019-05-27.16:02:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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__().


>>> 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/", line 409, in __del__
  File "/home/vstinner/prog/python/master/Lib/", line 903, in close
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.
Date User Action Args
2019-05-27 16:02:19vstinnersetrecipients: + vstinner, pitrou
2019-05-27 16:02:19vstinnersetmessageid: <>
2019-05-27 16:02:19vstinnerlinkissue37054 messages
2019-05-27 16:02:19vstinnercreate