]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-146480: Override the exception in _PyErr_SetKeyError() (#146486)
authorVictor Stinner <vstinner@python.org>
Fri, 27 Mar 2026 11:20:19 +0000 (12:20 +0100)
committerGitHub <noreply@github.com>
Fri, 27 Mar 2026 11:20:19 +0000 (11:20 +0000)
commitd4153a9f76736128306c4af01776729da846d926
treeb4644187af5120f314264ab89cab04e4813a4c2b
parentd0061d50b0f94f42650404352eb10e007c826100
gh-146480: Override the exception in _PyErr_SetKeyError() (#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).
Lib/test/test_capi/test_exceptions.py
Modules/_testinternalcapi.c
Python/errors.c