Skip to content

Commit 267ecf7

Browse files
Clear errors in JIT optimizer
1 parent 0e5d096 commit 267ecf7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Python/optimizer_analysis.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ const uint16_t op_without_decref_inputs[MAX_UOP_ID + 1] = {
461461
[_BINARY_OP_SUBTRACT_FLOAT] = _BINARY_OP_SUBTRACT_FLOAT__NO_DECREF_INPUTS,
462462
};
463463

464-
/* 1 for success, 0 for not ready, cannot error at the moment. */
464+
/* 1 for success, 0 for not ready, clears all possible errors. */
465465
static int
466466
optimize_uops(
467467
PyCodeObject *co,
@@ -471,6 +471,7 @@ optimize_uops(
471471
_PyBloomFilter *dependencies
472472
)
473473
{
474+
assert(!PyErr_Occurred());
474475

475476
JitOptContext context;
476477
JitOptContext *ctx = &context;
@@ -557,6 +558,10 @@ optimize_uops(
557558
OPT_ERROR_IN_OPCODE(opcode);
558559
}
559560
_Py_uop_abstractcontext_fini(ctx);
561+
562+
if (PyErr_Occurred()) {
563+
PyErr_Clear();
564+
}
560565
return -1;
561566

562567
}

0 commit comments

Comments
 (0)