diff options
author | Mark Shannon <mark@hotpy.org> | 2023-07-27 14:27:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-27 14:27:11 (GMT) |
commit | c6539b36c163efff3d6ed02b938a6151325f4db7 (patch) | |
tree | 628e61ae6907427baf9cf76e9d1a3d78525e6366 /Python/executor_cases.c.h | |
parent | d77d973335835bd744be8106010061cb338b0ae1 (diff) | |
download | cpython-c6539b36c163efff3d6ed02b938a6151325f4db7.zip cpython-c6539b36c163efff3d6ed02b938a6151325f4db7.tar.gz cpython-c6539b36c163efff3d6ed02b938a6151325f4db7.tar.bz2 |
GH-106895: Raise a `ValueError` when attempting to disable events that cannot be disabled. (GH-107337)
Diffstat (limited to 'Python/executor_cases.c.h')
-rw-r--r-- | Python/executor_cases.c.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index 0f04b42..f3e24bc 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -1949,7 +1949,12 @@ assert(val && PyExceptionInstance_Check(val)); exc = PyExceptionInstance_Class(val); tb = PyException_GetTraceback(val); - Py_XDECREF(tb); + if (tb == NULL) { + tb = Py_None; + } + else { + Py_DECREF(tb); + } assert(PyLong_Check(lasti)); (void)lasti; // Shut up compiler warning if asserts are off PyObject *stack[4] = {NULL, exc, val, tb}; |