-
-
Couldn't load subscription status.
- Fork 33.3k
gh-140650: fix SystemError in io.BufferedWriter.close when closed errors #140653
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also update CHECK_CLOSED to handle IS_CLOSED returning non-zero + setting an exception. In particular, if there's an exception CHECK_CLOSED should always return.
|
Should I still be using |
|
|
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.