summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-07-27 14:27:11 (GMT)
committerGitHub <noreply@github.com>2023-07-27 14:27:11 (GMT)
commitc6539b36c163efff3d6ed02b938a6151325f4db7 (patch)
tree628e61ae6907427baf9cf76e9d1a3d78525e6366 /Python/bytecodes.c
parentd77d973335835bd744be8106010061cb338b0ae1 (diff)
downloadcpython-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/bytecodes.c')
-rw-r--r--Python/bytecodes.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index da9d8e2..2b871e8 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -2672,7 +2672,12 @@ dummy_func(
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};