◐ Shell
clean mode source ↗

bpo-29587: Enable implicit exception chaining with gen.throw() by cjerdonek · Pull Request #19823 · python/cpython

added 2 commits

April 30, 2020 14:38
Before this commit, if an exception was active inside a generator
when calling gen.throw(), then that exception was lost (i.e. there
was no implicit exception chaining).  This commit fixes that.

1st1

vstinner

@vstinner vstinner changed the title bpo-29587: Enable implicit exception chaining with gen.throw() [WIP] bpo-29587: Enable implicit exception chaining with gen.throw()

Apr 30, 2020

@cjerdonek cjerdonek marked this pull request as ready for review

May 1, 2020 08:43

@cjerdonek cjerdonek changed the title [WIP] bpo-29587: Enable implicit exception chaining with gen.throw() bpo-29587: Enable implicit exception chaining with gen.throw()

May 1, 2020

vstinner

This was referenced

May 2, 2020

cjerdonek added a commit that referenced this pull request

May 3, 2020
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).