Title: Assertion `_tstate->jit_tracer_state.initial_state.func != NULL` failed in `_PyOptimizer_Optimize` · Issue #143610 · python/cpython · GitHub
Open Graph Title: Assertion `_tstate->jit_tracer_state.initial_state.func != NULL` failed in `_PyOptimizer_Optimize` · Issue #143610 · python/cpython
X Title: Assertion `_tstate->jit_tracer_state.initial_state.func != NULL` failed in `_PyOptimizer_Optimize` · Issue #143610 · python/cpython
Description: Crash report What happened? It's possible to abort a patched JIT build by running the code below. The interpreter must be called from a venv in which lafleur is installed as editable, likely due to that priming the GC into a state suitab...
Open Graph Description: Crash report What happened? It's possible to abort a patched JIT build by running the code below. The interpreter must be called from a venv in which lafleur is installed as editable, likely due to...
X Description: Crash report What happened? It's possible to abort a patched JIT build by running the code below. The interpreter must be called from a venv in which lafleur is installed as editable, likely du...
Opengraph URL: https://github.com/python/cpython/issues/143610
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Assertion `_tstate->jit_tracer_state.initial_state.func != NULL` failed in `_PyOptimizer_Optimize`","articleBody":"# Crash report\n\n### What happened?\n\nIt's possible to abort a patched JIT build by running the code below. The interpreter must be called from a venv in which lafleur is installed as editable, likely due to that priming the GC into a state suitable for the crash.\n\n\n\u003cdetails>\u003csummary>Necessary patch\u003c/summary>\n\u003cp>\n\n\n```diff\ndiff --git a/Include/internal/pycore_backoff.h b/Include/internal/pycore_backoff.h\nindex fadd11f04ec..3e779a141af 100644\n--- a/Include/internal/pycore_backoff.h\n+++ b/Include/internal/pycore_backoff.h\n@@ -125,7 +125,7 @@ trigger_backoff_counter(void)\n // For example, 4095 does not work for the nqueens benchmark on pyperformance\n // as we always end up tracing the loop iteration's\n // exhaustion iteration. Which aborts our current tracer.\n-#define JUMP_BACKWARD_INITIAL_VALUE 4000\n+#define JUMP_BACKWARD_INITIAL_VALUE 63\n #define JUMP_BACKWARD_INITIAL_BACKOFF 6\n static inline _Py_BackoffCounter\n initial_jump_backoff_counter(_PyPolicy *policy)\n@@ -139,7 +139,7 @@ initial_jump_backoff_counter(_PyPolicy *policy)\n * Must be larger than ADAPTIVE_COOLDOWN_VALUE,\n * otherwise when a side exit warms up we may construct\n * a new trace before the Tier 1 code has properly re-specialized. */\n-#define SIDE_EXIT_INITIAL_VALUE 4000\n+#define SIDE_EXIT_INITIAL_VALUE 63\n #define SIDE_EXIT_INITIAL_BACKOFF 6\n\n static inline _Py_BackoffCounter\n```\n\n\u003c/p>\n\u003c/details>\n\nTo install lafleur as editable, first create a venv and activate it, then clone the [lafleur repo](https://github.com/devdanzin/lafleur/) and run `pip install -e /path/to/lafleur/clone`.\n\nThis MRE must be invoked like this:\n\n```\n/path/to/venv/with/editable/lafleur/install/bin/python mre.py\n```\n\n\n\u003cdetails>\u003csummary>MRE\u003c/summary>\n\u003cp>\n\n\n```python\nimport email\nfrom itertools import batched\n\nf = 0.0\ns = \"\"\ni = 0\na: B\n\ndef f1():\n class P: 1\n\n for z in range(65): ...\n i + i\n i + i\n\n class A: ...\n\n class P:\n def _():\n if P: i\n\n i + 1\n f + f\n f + f\n\n class A:\n def _(): ...\n\n class C:\n def _():\n if C: i\n\n f + f\n c = f + f\n c = f + f\n s > s\n s > s\n s > s\n z * i\n z * i\n\n class a:\n def c(): i\n\n def _(): ...\n def __(): ...\n\n class A:\n def _():\n try:\n for _ in a: ...\n except: ...\n\n z * i\n 1 * i\n z * i\n z ^ i\n i ^ i\n i ^ i\n 1 ^ i\n 1 ^ i\n i & 1\n i & i\n\n class z:\n def __init__(C, a):\n C.A = 0\n\n def __aiter__(C): return C\n\n async def __anext__(C):\n if C.A:\n raise StopAsyncIteration\n C.A = 1\n\n class A:\n def _(): 0\n\n async def A():\n for _ in range(5):\n async for _ in z(1): ...\n\n try:\n a = A()\n a.send(None)\n except: ...\n\n class A:\n a: ...\n\n class A:\n def _(): ...\n\nfor _ in range(300):\n f1()\n```\n\n\u003c/p>\n\u003c/details>\n\n\u003cdetails>\u003csummary>Backtrace\u003c/summary>\n\u003cp>\n\n```batch\npython: Python/optimizer.c:144: int _PyOptimizer_Optimize(_PyInterpreterFrame *, PyThreadState *): Assertion `_tstate->jit_tracer_state.initial_state.func != NULL' failed.\n\nProgram received signal SIGABRT, Aborted.\n\n#0 __pthread_kill_implementation (threadid=\u003coptimized out>, signo=6, no_tid=0) at ./nptl/pthread_kill.c:44\n#1 __pthread_kill_internal (threadid=\u003coptimized out>, signo=6) at ./nptl/pthread_kill.c:89\n#2 __GI___pthread_kill (threadid=\u003coptimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:100\n#3 0x00007ffff7c45e2e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26\n#4 0x00007ffff7c28888 in __GI_abort () at ./stdlib/abort.c:77\n#5 0x00007ffff7c287f0 in __assert_fail_base (fmt=\u003coptimized out>, assertion=\u003coptimized out>, file=\u003coptimized out>, line=\u003coptimized out>, function=\u003coptimized out>) at ./assert/assert.c:118\n#6 0x00007ffff7c3c19f in __assert_fail (assertion=\u003coptimized out>, file=\u003coptimized out>, line=\u003coptimized out>, function=\u003coptimized out>) at ./assert/assert.c:127\n#7 0x00005555563e5f09 in _PyOptimizer_Optimize (frame=frame@entry=0x7e8ff6de5298, tstate=tstate@entry=0x555556ea42c0 \u003c_PyRuntime+359392>) at Python/optimizer.c:144\n#8 0x0000555555ed6364 in stop_tracing_and_jit (tstate=0x555556ea42c0 \u003c_PyRuntime+359392>, frame=frame@entry=0x7e8ff6de5298) at Python/ceval.c:1464\n#9 0x0000555555e94a95 in _PyEval_EvalFrameDefault (tstate=\u003coptimized out>, frame=\u003coptimized out>, throwflag=\u003coptimized out>) at Python/generated_cases.c.h:11580\n#10 0x0000555555e70c98 in _PyEval_EvalFrame (tstate=0x555556ea42c0 \u003c_PyRuntime+359392>, frame=0x7e8ff6de5220, throwflag=0) at ./Include/internal/pycore_ceval.h:118\n#11 _PyEval_Vector (tstate=\u003coptimized out>, func=\u003coptimized out>, locals=\u003coptimized out>, args=\u003coptimized out>, argcount=\u003coptimized out>, kwnames=0x0) at Python/ceval.c:2542\n#12 0x0000555555e706b5 in PyEval_EvalCode (co=\u003coptimized out>, globals=\u003coptimized out>, locals=0x7c7ff6e86440) at Python/ceval.c:1008\n#13 0x000055555647ae3f in run_eval_code_obj (tstate=tstate@entry=0x555556ea42c0 \u003c_PyRuntime+359392>, co=co@entry=0x7d2ff6e39290, globals=globals@entry=0x7c7ff6e86440,\n locals=locals@entry=0x7c7ff6e86440) at Python/pythonrun.c:1366\n#14 0x000055555647a00c in run_mod (mod=\u003coptimized out>, filename=\u003coptimized out>, globals=\u003coptimized out>, locals=\u003coptimized out>, flags=\u003coptimized out>, arena=\u003coptimized out>,\n interactive_src=\u003coptimized out>, generate_new_source=\u003coptimized out>) at Python/pythonrun.c:1469\n#15 0x000055555647460d in pyrun_file (fp=fp@entry=0x7d4ff6e03300, filename=filename@entry=0x7ccff6e2a6a0, start=start@entry=257, globals=globals@entry=0x7c7ff6e86440,\n locals=locals@entry=0x7c7ff6e86440, closeit=closeit@entry=1, flags=0x7bfff5c3df10) at Python/pythonrun.c:1294\n#16 0x000055555647216d in _PyRun_SimpleFileObject (fp=\u003coptimized out>, filename=\u003coptimized out>, closeit=\u003coptimized out>, flags=\u003coptimized out>) at Python/pythonrun.c:518\n#17 0x00005555564714de in _PyRun_AnyFileObject (fp=fp@entry=0x7d4ff6e03300, filename=filename@entry=0x7ccff6e2a6a0, closeit=closeit@entry=1, flags=flags@entry=0x7bfff5c3df10)\n at Python/pythonrun.c:81\n#18 0x00005555564ed64b in pymain_run_file_obj (program_name=0x7caff6e80ae0, filename=0x7ccff6e2a6a0, skip_source_first_line=0) at Modules/main.c:410\n#19 pymain_run_file (config=0x555556e6f398 \u003c_PyRuntime+142520>) at Modules/main.c:429\n#20 0x00005555564eb714 in pymain_run_python (exitcode=0x7bfff5c3db00) at Modules/main.c:691\n#21 Py_RunMain () at Modules/main.c:772\n#22 0x00005555564ec617 in pymain_main (args=\u003coptimized out>) at Modules/main.c:802\n#23 0x00005555564ec788 in Py_BytesMain (argc=\u003coptimized out>, argv=0x7fffffffdb98) at Modules/main.c:826\n#24 0x00007ffff7c2a575 in __libc_start_call_main (main=main@entry=0x55555591cc40 \u003cmain>, argc=argc@entry=2, argv=argv@entry=0x7fffffffdb98) at ../sysdeps/nptl/libc_start_call_main.h:58\n#25 0x00007ffff7c2a628 in __libc_start_main_impl (main=0x55555591cc40 \u003cmain>, argc=2, argv=0x7fffffffdb98, init=\u003coptimized out>, fini=\u003coptimized out>, rtld_fini=\u003coptimized out>,\n stack_end=0x7fffffffdb88) at ../csu/libc-start.c:360\n#26 0x00005555558334f5 in _start ()\n```\n\n\u003c/p>\n\u003c/details>\n\nOutput from running with `PYTHON_LLTRACE=4 PYTHON_OPT_DEBUG=4`:\n[093730_abort_lltrace_opt_debug.txt](https://github.com/user-attachments/files/24529440/093730_abort_lltrace_opt_debug.txt)\n\nFound using [lafleur](https://github.com/devdanzin/lafleur/).\n\n\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n### Output from running 'python -VV' on the command line:\n\nPython 3.15.0a3+ (heads/main-dirty:6d54b6ac7d5, Jan 9 2026, 11:35:46) [Clang 21.1.2 (2ubuntu6)]","author":{"url":"https://github.com/devdanzin","@type":"Person","name":"devdanzin"},"datePublished":"2026-01-09T14:47:09Z","url":"https://github.com/python/cpython/issues/143610"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2bef1c8f-c43b-df37-2193-f18d6964291a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A3AC:24645:2129195:2B8B60A:6B023F3A |
| html-safe-nonce | e8cc5ffa0c051f9795429c7aff1c301ac7dd0702ca95a50e70a31d4897fa68b4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBM0FDOjI0NjQ1OjIxMjkxOTU6MkI4QjYwQTo2QjAyM0YzQSIsInZpc2l0b3JfaWQiOiIzNjUyOTUxNzQ2Njg4NDY2NzQ2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 7d7161bcc5ea5d804c7656011214d1df973a60cd7329da604c2aef3f7cd79917 |
| hovercard-subject-tag | issue:3797212704 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/143610/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f2962bedda8f3fb7f010b0880c69dea3cb4b776b7dbcbce83ed6a839131d9de6/python/cpython/issues/143610 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f2962bedda8f3fb7f010b0880c69dea3cb4b776b7dbcbce83ed6a839131d9de6/python/cpython/issues/143610 |
| og:image:alt | Crash report What happened? It's possible to abort a patched JIT build by running the code below. The interpreter must be called from a venv in which lafleur is installed as editable, likely due to... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | devdanzin |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width