[3.12] GH-106895: Raise a ValueError when attempting to disable events that cannot be disabled. (GH-107337) (GH-107351)

This commit is contained in:
Mark Shannon 2023-07-28 10:53:33 +01:00 committed by GitHub
parent 3b1a4c1842
commit 0902afbae2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 207 additions and 144 deletions

View file

@ -2476,7 +2476,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};