[issue37054] Ignored exceptions in test_memoryio
STINNER Victor
report at bugs.python.org
Mon May 27 12:02:19 EDT 2019
STINNER Victor <vstinner at redhat.com> added the comment:
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.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37054>
_______________________________________
More information about the Python-bugs-list
mailing list