There was an error while loading. Please reload this page.
1 parent 35df805 commit 25a48d9Copy full SHA for 25a48d9
2 files changed
Misc/NEWS.d/next/Core_and_Builtins/2025-07-22-16-20-06.gh-issue-137007.1oPvvK.rst
@@ -0,0 +1 @@
1
+Fix a bug during JIT compilation failure which caused garbage collection debug assertions to fail.
Python/optimizer.c
@@ -1213,6 +1213,10 @@ make_executor_from_uops(_PyUOpInstruction *buffer, int length, const _PyBloomFil
1213
assert(next_exit == -1);
1214
assert(dest == executor->trace);
1215
assert(dest->opcode == _START_EXECUTOR);
1216
+ // Note: we MUST track it here before any Py_DECREF(executor) or
1217
+ // linking of executor. Otherwise, the GC tries to untrack a
1218
+ // still untracked object during dealloc.
1219
+ _PyObject_GC_TRACK(executor);
1220
_Py_ExecutorInit(executor, dependencies);
1221
#ifdef Py_DEBUG
1222
char *python_lltrace = Py_GETENV("PYTHON_LLTRACE");
@@ -1242,7 +1246,6 @@ make_executor_from_uops(_PyUOpInstruction *buffer, int length, const _PyBloomFil
1242
1246
return NULL;
1243
1247
}
1244
1248
#endif
1245
- _PyObject_GC_TRACK(executor);
1249
return executor;
1250
1251
0 commit comments