summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-07-28 08:48:35 (GMT)
committerGitHub <noreply@github.com>2023-07-28 08:48:35 (GMT)
commit3b1a4c18426c78a2fda0d59728bfe9eb92889722 (patch)
treec512a79c5cd867b030ce76fa757968749b895d6c /Python/bytecodes.c
parent4014869b4b2456b3da1118a37332f9e9e851aebf (diff)
downloadcpython-3b1a4c18426c78a2fda0d59728bfe9eb92889722.zip
cpython-3b1a4c18426c78a2fda0d59728bfe9eb92889722.tar.gz
cpython-3b1a4c18426c78a2fda0d59728bfe9eb92889722.tar.bz2
[3.12] GH-106897: Add `RERAISE` event to `sys.monitoring`. (GH-107291) (GH-107346)
* Ensures that exception handling events are balanced. Each [re]raise event has a matching unwind/handled event.
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index b914afa..adfa5ce 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -612,7 +612,11 @@ dummy_func(
exc = args[0];
/* fall through */
case 0:
- ERROR_IF(do_raise(tstate, exc, cause), exception_unwind);
+ if (do_raise(tstate, exc, cause)) {
+ assert(oparg == 0);
+ monitor_reraise(tstate, frame, next_instr-1);
+ goto exception_unwind;
+ }
break;
default:
_PyErr_SetString(tstate, PyExc_SystemError,
@@ -944,6 +948,7 @@ dummy_func(
assert(exc && PyExceptionInstance_Check(exc));
Py_INCREF(exc);
_PyErr_SetRaisedException(tstate, exc);
+ monitor_reraise(tstate, frame, next_instr-1);
goto exception_unwind;
}
@@ -955,6 +960,7 @@ dummy_func(
else {
Py_INCREF(exc);
_PyErr_SetRaisedException(tstate, exc);
+ monitor_reraise(tstate, frame, next_instr-1);
goto exception_unwind;
}
}
@@ -969,6 +975,7 @@ dummy_func(
}
else {
_PyErr_SetRaisedException(tstate, Py_NewRef(exc_value));
+ monitor_reraise(tstate, frame, next_instr-1);
goto exception_unwind;
}
}