]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-29587: allow chaining NULL exceptions in _gen_throw() (GH-19877)
authorChris Jerdonek <chris.jerdonek@gmail.com>
Sun, 3 May 2020 07:07:57 +0000 (00:07 -0700)
committerGitHub <noreply@github.com>
Sun, 3 May 2020 07:07:57 +0000 (00:07 -0700)
commit21893fbb74e8fde2931fbed9b511e2a41362b1ab
treedaa9478ff24df319924478b9de7a435aee101b04
parent0400a7f2f8abec8d441990e951cc25f69a2a4036
bpo-29587: allow chaining NULL exceptions in _gen_throw() (GH-19877)

This is a follow-up to GH-19823 that removes the check that the
exception value isn't NULL, prior to calling _PyErr_ChainExceptions().
This enables implicit exception chaining for gen.throw() in more
circumstances.

The commit also adds a test that a particular code snippet involving
gen.throw() doesn't crash.  The test shows why the new
`gi_exc_state.exc_type != Py_None` check that was added is necessary.
Without the new check, the code snippet (as well as a number of other
tests) crashes on certain platforms (e.g. Fedora but not Mac).
Lib/test/test_generators.py
Objects/genobject.c