Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue37054

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Ignored exceptions in test_memoryio
Type:behaviorStage:resolved
Components:Library (Lib), TestsVersions:Python 3.8
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: miss-islington, pitrou, vstinner
Priority:normalKeywords:patch

Created on2019-05-26 14:54 bypitrou, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 13601mergedvstinner,2019-05-27 23:07
PR 13604mergedmiss-islington,2019-05-27 23:44
Messages (7)
msg343552 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)Date: 2019-05-26 14:54
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._bufferAttributeError: '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._bufferAttributeError: 'StringIO' object has no attribute '_buffer'okIt seems this could be related toissue18748.
msg343652 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2019-05-27 16:02
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.
msg343653 -(view)Author: Antoine Pitrou (pitrou)*(Python committer)Date: 2019-05-27 16:04
Or to add `_buffer = None` at the class level.
msg343700 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2019-05-27 23:08
Antoine:> Or to add `_buffer = None` at the class level.Ok, I wrotebpo-13601 to implement this idea and fix test_memoryio warnings.
msg343709 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2019-05-27 23:44
New changeseta3568417c49f36860393075b21c93996a5f6799b by Victor Stinner in branch 'master':bpo-37054, _pyio: Fix BytesIO and TextIOWrapper __del__() (GH-13601)https://github.com/python/cpython/commit/a3568417c49f36860393075b21c93996a5f6799b
msg343718 -(view)Author: miss-islington (miss-islington)Date: 2019-05-28 00:05
New changeset0f352d44e7c14c1c93e3999402c85512b9d5a6ca by Miss Islington (bot) in branch '3.7':bpo-37054, _pyio: Fix BytesIO and TextIOWrapper __del__() (GH-13601)https://github.com/python/cpython/commit/0f352d44e7c14c1c93e3999402c85512b9d5a6ca
msg343720 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2019-05-28 00:19
Thanks for the report Antoine. It is now fixed in 3.7 and master branches.
History
DateUserActionArgs
2022-04-11 14:59:15adminsetgithub: 81235
2019-05-28 00:19:06vstinnersetstatus: open -> closed
resolution: fixed
messages: +msg343720

stage: patch review -> resolved
2019-05-28 00:05:55miss-islingtonsetnosy: +miss-islington
messages: +msg343718
2019-05-27 23:44:31miss-islingtonsetpull_requests: +pull_request13510
2019-05-27 23:44:24vstinnersetmessages: +msg343709
2019-05-27 23:08:12vstinnersetmessages: +msg343700
2019-05-27 23:07:10vstinnersetkeywords: +patch
stage: patch review
pull_requests: +pull_request13507
2019-05-27 16:04:33pitrousetmessages: +msg343653
2019-05-27 16:02:19vstinnersetmessages: +msg343652
2019-05-26 14:54:40pitroucreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp