bpo-38733: PyErr_Occurred() caller must hold the GIL by vstinner · Pull Request #17080 · python/cpython (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation3 Commits1 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
bpo-3605, bpo-38733: Optimize _PyErr_Occurred(): remove "tstate ==
NULL" test.
Py_FatalError() no longer calls PyErr_Occurred() if called without
holding the GIL. So PyErr_Occurred() no longer has to support
tstate==NULL case.
_Py_CheckFunctionResult(): use directly _PyErr_Occurred() to avoid
explicit "!= NULL" test.
https://bugs.python.org/issue38733
bpo-3605, bpo-38733: Optimize _PyErr_Occurred(): remove "tstate == NULL" test.
Py_FatalError() no longer calls PyErr_Occurred() if called without holding the GIL. So PyErr_Occurred() no longer has to support tstate==NULL case.
_Py_CheckFunctionResult(): use directly _PyErr_Occurred() to avoid explicit "!= NULL" test.
vstinner changed the title
bpo-38733: The GIL must be hold to call PyErr_Occurred() bpo-38733: PyErr_Occurred() caller must hold the GIL
@pablogsal, @serhiy-storchaka, @methane, @pitrou: Would you mind to review this change?
I didn't add a NEWS entry since I consider that PyErr_Occurred() caller always had to hold the GIL. Do you consider that it should be documented?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@pitrou, @serhiy-storchaka: Oh, thanks for your quick approval.
I really wasn't sure about this change on the critical function PyErr_Occurred(). Well, if this change breaks too many projects, we still have time to revert is before 3.9 final and plan a better upgrade path ;-)
jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request
bpo-3605, bpo-38733: Optimize _PyErr_Occurred(): remove "tstate == NULL" test.
Py_FatalError() no longer calls PyErr_Occurred() if called without holding the GIL. So PyErr_Occurred() no longer has to support tstate==NULL case.
_Py_CheckFunctionResult(): use directly _PyErr_Occurred() to avoid explicit "!= NULL" test.
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request
bpo-3605, bpo-38733: Optimize _PyErr_Occurred(): remove "tstate == NULL" test.
Py_FatalError() no longer calls PyErr_Occurred() if called without holding the GIL. So PyErr_Occurred() no longer has to support tstate==NULL case.
_Py_CheckFunctionResult(): use directly _PyErr_Occurred() to avoid explicit "!= NULL" test.