Title: JIT: Assertion `exc && PyExceptionInstance_Check(exc)` failed in `*_PyEval_EvalFrameDefault` · Issue #143358 · python/cpython · GitHub
Open Graph Title: JIT: Assertion `exc && PyExceptionInstance_Check(exc)` failed in `*_PyEval_EvalFrameDefault` · Issue #143358 · python/cpython
X Title: JIT: Assertion `exc && PyExceptionInstance_Check(exc)` failed in `*_PyEval_EvalFrameDefault` · Issue #143358 · python/cpython
Description: Crash report What happened? It's possible to cause an abort in a patched debug JIT build by running the following MRE. The necessary patch: diff --git a/Include/internal/pycore_backoff.h b/Include/internal/pycore_backoff.h index 23ca7299...
Open Graph Description: Crash report What happened? It's possible to cause an abort in a patched debug JIT build by running the following MRE. The necessary patch: diff --git a/Include/internal/pycore_backoff.h b/Include/...
X Description: Crash report What happened? It's possible to cause an abort in a patched debug JIT build by running the following MRE. The necessary patch: diff --git a/Include/internal/pycore_backoff.h b/Incl...
Opengraph URL: https://github.com/python/cpython/issues/143358
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"JIT: Assertion `exc && PyExceptionInstance_Check(exc)` failed in `*_PyEval_EvalFrameDefault`","articleBody":"# Crash report\n\n### What happened?\n\nIt's possible to cause an abort in a patched debug JIT build by running the following MRE.\n\nThe necessary patch:\n```diff\ndiff --git a/Include/internal/pycore_backoff.h b/Include/internal/pycore_backoff.h\nindex 23ca7299e0d..0289b5fee7c 100644\n--- a/Include/internal/pycore_backoff.h\n+++ b/Include/internal/pycore_backoff.h\n@@ -124,7 +124,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(void)\n@@ -137,7 +137,7 @@ initial_jump_backoff_counter(void)\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\nMRE:\n```python\ndef f1():\n\n class EvilIterator:\n\n def __init__(self):\n self._items = [1, 2]\n self._index = 1\n\n def __iter__(self):\n return self\n\n def __next__(self):\n if not len(self._items) % 13:\n self._items.clear()\n\n for i_loop_9279 in range(10):\n self._items.extend([1, \"\", None])\n\n if not len(self._items) % 11:\n return 'unexpected_type_from_iterator'\n\n if self._index >= len(self._items):\n raise StopIteration\n\n item = self._items[self._index]\n self._index += 1\n return item\n\n evil_iter = EvilIterator()\n\n large_num = 2**31\n for _ in range(400):\n try:\n _ = [x + y for x in evil_iter for y in evil_iter if evil_iter._items.append(x) or large_num]\n except TypeError:\n pass\n\nf1()\n```\n\nBacktrace:\n```batch\npython: Python/generated_cases.c.h:9901: PyObject *_PyEval_EvalFrameDefault(PyThreadState *, _PyInterpreterFrame *, int): Assertion `exc && PyExceptionInstance_Check(exc)' 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 0x0000555555ebab3f in _PyEval_EvalFrameDefault (tstate=\u003coptimized out>, frame=\u003coptimized out>, throwflag=\u003coptimized out>) at Python/generated_cases.c.h:9901\n#8 0x0000555555e6dc98 in _PyEval_EvalFrame (tstate=0x555556e808c0 \u003c_PyRuntime+359392>, frame=0x7e8ff6fe5220, throwflag=0) at ./Include/internal/pycore_ceval.h:118\n#9 _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#10 0x0000555555e6d6b5 in PyEval_EvalCode (co=\u003coptimized out>, globals=\u003coptimized out>, locals=0x7c7ff70865c0) at Python/ceval.c:1008\n#11 0x00005555564626df in run_eval_code_obj (tstate=tstate@entry=0x555556e808c0 \u003c_PyRuntime+359392>, co=co@entry=0x7d1ff701afd0, globals=globals@entry=0x7c7ff70865c0,\n locals=locals@entry=0x7c7ff70865c0) at Python/pythonrun.c:1366\n#12 0x00005555564618ac 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#13 0x000055555645bead in pyrun_file (fp=fp@entry=0x7d4ff6fefa80, filename=filename@entry=0x7ccff6ffafc0, start=start@entry=257, globals=globals@entry=0x7c7ff70865c0,\n locals=locals@entry=0x7c7ff70865c0, closeit=closeit@entry=1, flags=0x7bfff5e1e910) at Python/pythonrun.c:1294\n#14 0x0000555556459a0d in _PyRun_SimpleFileObject (fp=\u003coptimized out>, filename=\u003coptimized out>, closeit=\u003coptimized out>, flags=\u003coptimized out>) at Python/pythonrun.c:518\n#15 0x0000555556458d7e in _PyRun_AnyFileObject (fp=fp@entry=0x7d4ff6fefa80, filename=filename@entry=0x7ccff6ffafc0, closeit=closeit@entry=1, flags=flags@entry=0x7bfff5e1e910)\n at Python/pythonrun.c:81\n#16 0x00005555564d4cfb in pymain_run_file_obj (program_name=0x7caff7026d50, filename=0x7ccff6ffafc0, skip_source_first_line=0) at Modules/main.c:410\n#17 pymain_run_file (config=0x555556e4b998 \u003c_PyRuntime+142520>) at Modules/main.c:429\n#18 0x00005555564d2dc4 in pymain_run_python (exitcode=0x7bfff5e1e500) at Modules/main.c:691\n#19 Py_RunMain () at Modules/main.c:772\n#20 0x00005555564d3cc7 in pymain_main (args=\u003coptimized out>) at Modules/main.c:802\n#21 0x00005555564d3e38 in Py_BytesMain (argc=\u003coptimized out>, argv=0x7fffffffdbe8) at Modules/main.c:826\n#22 0x00007ffff7c2a575 in __libc_start_call_main (main=main@entry=0x555555919c40 \u003cmain>, argc=argc@entry=2, argv=argv@entry=0x7fffffffdbe8) at ../sysdeps/nptl/libc_start_call_main.h:58\n#23 0x00007ffff7c2a628 in __libc_start_main_impl (main=0x555555919c40 \u003cmain>, argc=2, argv=0x7fffffffdbe8, init=\u003coptimized out>, fini=\u003coptimized out>, rtld_fini=\u003coptimized out>,\n stack_end=0x7fffffffdbd8) at ../csu/libc-start.c:360\n#24 0x00005555558304f5 in _start ()\n```\n\nOutput from running with `PYTHON_LLTRACE=4 PYTHON_OPT_DEBUG=4`:\n[2394_segfault_lltrace.txt](https://github.com/user-attachments/files/24408834/2394_segfault_lltrace.txt)\n\nFound using [lafleur](https://github.com/devdanzin/lafleur/).\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:61f2ad9a3a7, Jan 2 2026, 11:43:51) [Clang 21.1.2 (2ubuntu6)]","author":{"url":"https://github.com/devdanzin","@type":"Person","name":"devdanzin"},"datePublished":"2026-01-02T14:54:50Z","url":"https://github.com/python/cpython/issues/143358"}
| 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:7459a659-97fb-25dd-810e-bf9d88f8d54f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8BCA:E0ADF:1BFE8F1:234040F:6B02368D |
| html-safe-nonce | f31524fe997ee9359caab391aa19c38375fce2c5cd414264c202d58073bca6bd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QkNBOkUwQURGOjFCRkU4RjE6MjM0MDQwRjo2QjAyMzY4RCIsInZpc2l0b3JfaWQiOiI4OTQ4OTI2Nzg1MjM2NjQ1NTE3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5bcda256313a130e9f0a364f786e93c8365e1e6974e0e2961688d6a58b687ac3 |
| hovercard-subject-tag | issue:3776531368 |
| 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/143358/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a714af209b75b2423a8e59069df237e06f1a632347b9b87a2f2a6e16e8b8235d/python/cpython/issues/143358 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a714af209b75b2423a8e59069df237e06f1a632347b9b87a2f2a6e16e8b8235d/python/cpython/issues/143358 |
| og:image:alt | Crash report What happened? It's possible to cause an abort in a patched debug JIT build by running the following MRE. The necessary patch: diff --git a/Include/internal/pycore_backoff.h b/Include/... |
| 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