]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-146480: Override the exception in _PyErr_SetKeyError() (GH-146486) (#146511)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 27 Mar 2026 11:48:29 +0000 (12:48 +0100)
committerGitHub <noreply@github.com>
Fri, 27 Mar 2026 11:48:29 +0000 (11:48 +0000)
commitd7e04e7b8d335542f3f9acacc3f0b8428e0916e6
tree64637a788723671194664cdc50ed10006b70b612
parentcba54979dfe33a579394e02fdaa55326663bd274
[3.14] gh-146480: Override the exception in _PyErr_SetKeyError() (GH-146486) (#146511)

gh-146480: Override the exception in _PyErr_SetKeyError() (GH-146486)

If _PyErr_SetKeyError() is called with an exception set, it now
replaces the current exception with KeyError (as expected), instead
of setting a SystemError or failing with a fatal error (in debug
mode).
(cherry picked from commit d4153a9f76736128306c4af01776729da846d926)

Co-authored-by: Victor Stinner <vstinner@python.org>
Lib/test/test_capi/test_exceptions.py
Modules/_testinternalcapi.c
Python/errors.c