-
-
Notifications
You must be signed in to change notification settings - Fork 29.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
bpo-34068: _io__IOBase_close_impl could call _PyObject_SetAttrId with an exception set #8282
Conversation
The code could be simpler: PyErr_Fetch(&exc, &val, &tb);
rc = _PyObject_SetAttrId(self, &PyId___IOBase_closed, Py_True);
_PyErr_ChainExceptions(exc, val, tb);
if (rc < 0) {
Py_CLEAR(res);
} |
… an exception set
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.
LGTM, but I have a minor request on the NEWS entry.
@@ -0,0 +1,2 @@ | |||
In :meth:`io.IOBase.close`, ensure that ``_PyObject_SetAttrId()`` is not |
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.
In the changelog, you should try to avoid to mention low-level C internals. You can say something like: "In io.IOBase.close, ensure that the closed attribute is not set to True with a live exception. (...)".
Thanks @ZackerySpytz for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6. |
Thanks @ZackerySpytz for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7. |
Thanks @ZackerySpytz for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7. |
GH-8310 is a backport of this pull request to the 3.7 branch. |
… an exception set (pythonGH-8282) (cherry picked from commit 28f0736) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Sorry, @ZackerySpytz and @serhiy-storchaka, I could not cleanly backport this to |
Sorry, @ZackerySpytz and @serhiy-storchaka, I could not cleanly backport this to |
…d with an exception set (pythonGH-8282). (cherry picked from commit 28f0736) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
GH-8312 is a backport of this pull request to the 3.6 branch. |
Thanks. It now LGTM ;-) Thanks for the fix @ZackerySpytz! |
…d with an exception set (pythonGH-8282). (pythonGH-8312) (cherry picked from commit 28f0736) Co-authored-by: Zackery Spytz <zspytz@gmail.com>. (cherry picked from commit cc13016) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
https://bugs.python.org/issue34068