-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignored exceptions in test_memoryio #81235
Comments
I see the following kind of exceptions when running test_memoryio: Exception ignored in: <function IOBase.__del__ at 0x7f7cd44f49b0>
Traceback (most recent call last):
File "/home/antoine/cpython/default/Lib/_pyio.py", line 409, in __del__
self.close()
File "/home/antoine/cpython/default/Lib/_pyio.py", line 2152, in close
if self.buffer is not None and not self.closed:
File "/home/antoine/cpython/default/Lib/_pyio.py", line 2093, in buffer
return self._buffer
AttributeError: 'StringIO' object has no attribute '_buffer'
Exception ignored in: <function IOBase.__del__ at 0x7f7cd44f49b0>
Traceback (most recent call last):
File "/home/antoine/cpython/default/Lib/_pyio.py", line 409, in __del__
self.close()
File "/home/antoine/cpython/default/Lib/_pyio.py", line 2152, in close
if self.buffer is not None and not self.closed:
File "/home/antoine/cpython/default/Lib/_pyio.py", line 2093, in buffer
return self._buffer
AttributeError: 'StringIO' object has no attribute '_buffer'
ok It seems this could be related to bpo-18748. |
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:
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. |
Or to add |
Antoine:
Ok, I wrote bpo-13601 to implement this idea and fix test_memoryio warnings. |
Thanks for the report Antoine. It is now fixed in 3.7 and master branches. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: