gh-140650: fix SystemError in io.BufferedWriter.close when closed errors#140653
gh-140650: fix SystemError in io.BufferedWriter.close when closed errors#140653serhiy-storchaka merged 7 commits intopython:mainfrom
Conversation
serhiy-storchaka
left a comment
There was a problem hiding this comment.
This does not look right. If IS_CLOSED() returns a positive value and sets an error, there is a bug in IS_CLOSED().
|
@serhiy-storchaka : Overall problem is code assumes Another option here is "Exception" can be turned into a True result for "IS_CLOSED" + clear the exception but that seems like hiding an implemention issue rather than helping resolve it to me. |
|
|
|
Should I still be using |
|
|
Misc/NEWS.d/next/Library/2025-10-27-00-40-49.gh-issue-140650.DYJPJ9.rst
Outdated
Show resolved
Hide resolved
…redWriter (pythonGH-140653) They could raise SystemError or crash when getting the "closed" attribute or converting it to boolean raises an exception.
Restores the 3.14 behavior of emitting a TypeError. Preservation of the sign helps in the error checking here:
cpython/Modules/_io/bufferedio.c
Lines 556 to 563 in 3dab11f
db68bfc changed from
buffered_closedtoIS_CLOSED.