summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2023-08-10-00-00-48.gh-issue-106581.o7zDty.rst2
-rw-r--r--Python/bytecodes.c10
-rw-r--r--Python/executor_cases.c.h10
-rw-r--r--Python/generated_cases.c.h10
4 files changed, 20 insertions, 12 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-08-10-00-00-48.gh-issue-106581.o7zDty.rst b/Misc/NEWS.d/next/Core and Builtins/2023-08-10-00-00-48.gh-issue-106581.o7zDty.rst
new file mode 100644
index 0000000..dff1ebd
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2023-08-10-00-00-48.gh-issue-106581.o7zDty.rst
@@ -0,0 +1,2 @@
+Fix possible assertion failures and missing instrumentation events when
+:envvar:`PYTHONUOPS` or :option:`-X uops <-X>` is enabled.
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index a5cb117..a55460a 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -133,17 +133,19 @@ dummy_func(
}
inst(RESUME, (--)) {
- #if TIER_ONE
assert(frame == tstate->current_frame);
/* Possibly combine this with eval breaker */
if (_PyFrame_GetCode(frame)->_co_instrumentation_version != tstate->interp->monitoring_version) {
int err = _Py_Instrument(_PyFrame_GetCode(frame), tstate->interp);
ERROR_IF(err, error);
+ #if TIER_ONE
next_instr--;
+ #endif
+ #if TIER_TWO
+ goto deoptimize;
+ #endif
}
- else
- #endif
- if (oparg < 2) {
+ else if (oparg < 2) {
CHECK_EVAL_BREAKER();
}
}
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index 85c60c2..1283cc7 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -8,17 +8,19 @@
}
case RESUME: {
- #if TIER_ONE
assert(frame == tstate->current_frame);
/* Possibly combine this with eval breaker */
if (_PyFrame_GetCode(frame)->_co_instrumentation_version != tstate->interp->monitoring_version) {
int err = _Py_Instrument(_PyFrame_GetCode(frame), tstate->interp);
if (err) goto error;
+ #if TIER_ONE
next_instr--;
+ #endif
+ #if TIER_TWO
+ goto deoptimize;
+ #endif
}
- else
- #endif
- if (oparg < 2) {
+ else if (oparg < 2) {
CHECK_EVAL_BREAKER();
}
break;
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 4aa16f8..3f46f1a 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -8,17 +8,19 @@
}
TARGET(RESUME) {
- #if TIER_ONE
assert(frame == tstate->current_frame);
/* Possibly combine this with eval breaker */
if (_PyFrame_GetCode(frame)->_co_instrumentation_version != tstate->interp->monitoring_version) {
int err = _Py_Instrument(_PyFrame_GetCode(frame), tstate->interp);
if (err) goto error;
+ #if TIER_ONE
next_instr--;
+ #endif
+ #if TIER_TWO
+ goto deoptimize;
+ #endif
}
- else
- #endif
- if (oparg < 2) {
+ else if (oparg < 2) {
CHECK_EVAL_BREAKER();
}
DISPATCH();