Title: Main segfaults importing `_pyrepl` with low value for `JUMP_BACKWARD_INITIAL_VALUE` · Issue #137218 · python/cpython · GitHub
Open Graph Title: Main segfaults importing `_pyrepl` with low value for `JUMP_BACKWARD_INITIAL_VALUE` · Issue #137218 · python/cpython
X Title: Main segfaults importing `_pyrepl` with low value for `JUMP_BACKWARD_INITIAL_VALUE` · Issue #137218 · python/cpython
Description: Crash report What happened? Edit: I'm seeing this crash even without patching JUMP_BACKWARD_INITIAL_VALUE. Will try to figure out a MRE for unpatched crash. If we #define JUMP_BACKWARD_INITIAL_VALUE 702 (or lower) in Include/internal/pyc...
Open Graph Description: Crash report What happened? Edit: I'm seeing this crash even without patching JUMP_BACKWARD_INITIAL_VALUE. Will try to figure out a MRE for unpatched crash. If we #define JUMP_BACKWARD_INITIAL_VALU...
X Description: Crash report What happened? Edit: I'm seeing this crash even without patching JUMP_BACKWARD_INITIAL_VALUE. Will try to figure out a MRE for unpatched crash. If we #define JUMP_BACKWARD_INITIAL_...
Opengraph URL: https://github.com/python/cpython/issues/137218
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Main segfaults importing `_pyrepl` with low value for `JUMP_BACKWARD_INITIAL_VALUE`","articleBody":"# Crash report\n\n### What happened?\n\nEdit: I'm seeing this crash even without patching `JUMP_BACKWARD_INITIAL_VALUE`. Will try to figure out a MRE for unpatched crash.\n\nIf we `#define JUMP_BACKWARD_INITIAL_VALUE 702` (or lower) in `Include/internal/pycore_backoff.h`, a debug JIT build will segfault when trying to run to the new REPL. Can also be triggered by:\n\n```\npython -m _pyrepl\n```\n\nUsing some other modules like `random` or `http.server` doesn't crash.\n\nAn even lower value like 344 will segfault earlier, during the build process.\n\nThis happens since https://github.com/python/cpython/pull/136307 landed in 377b787. \n\nThe diff below, which is part of that commit, is enough to cause the segfault together with defining `JUMP_BACKWARD_INITIAL_VALUE` to 702 or lower:\n```diff\ndiff --git a/Include/internal/pycore_global_objects_fini_generated.h b/Include/internal/pycore_global_objects_fini_generated.h\nindex 493377b4c25..5e7dda3a371 100644\n--- a/Include/internal/pycore_global_objects_fini_generated.h\n+++ b/Include/internal/pycore_global_objects_fini_generated.h\n@@ -1005,6 +1005,7 @@ _PyStaticObjects_CheckRefcnt(PyInterpreterState *interp) {\n _PyStaticObject_CheckRefcnt((PyObject *)\u0026_Py_ID(imag));\n _PyStaticObject_CheckRefcnt((PyObject *)\u0026_Py_ID(importlib));\n _PyStaticObject_CheckRefcnt((PyObject *)\u0026_Py_ID(in_fd));\n+ _PyStaticObject_CheckRefcnt((PyObject *)\u0026_Py_ID(include_aliases));\n _PyStaticObject_CheckRefcnt((PyObject *)\u0026_Py_ID(incoming));\n _PyStaticObject_CheckRefcnt((PyObject *)\u0026_Py_ID(index));\n _PyStaticObject_CheckRefcnt((PyObject *)\u0026_Py_ID(indexgroup));\ndiff --git a/Include/internal/pycore_global_strings.h b/Include/internal/pycore_global_strings.h\nindex 5dfea2f479d..6908cbf78f3 100644\n--- a/Include/internal/pycore_global_strings.h\n+++ b/Include/internal/pycore_global_strings.h\n@@ -496,6 +496,7 @@ struct _Py_global_strings {\n STRUCT_FOR_ID(imag)\n STRUCT_FOR_ID(importlib)\n STRUCT_FOR_ID(in_fd)\n+ STRUCT_FOR_ID(include_aliases)\n STRUCT_FOR_ID(incoming)\n STRUCT_FOR_ID(index)\n STRUCT_FOR_ID(indexgroup)\ndiff --git a/Include/internal/pycore_runtime_init_generated.h b/Include/internal/pycore_runtime_init_generated.h\nindex 85ced09d29d..da2ed7422c9 100644\n--- a/Include/internal/pycore_runtime_init_generated.h\n+++ b/Include/internal/pycore_runtime_init_generated.h\n@@ -1003,6 +1003,7 @@ extern \"C\" {\n INIT_ID(imag), \\\n INIT_ID(importlib), \\\n INIT_ID(in_fd), \\\n+ INIT_ID(include_aliases), \\\n INIT_ID(incoming), \\\n INIT_ID(index), \\\n INIT_ID(indexgroup), \\\ndiff --git a/Include/internal/pycore_unicodeobject_generated.h b/Include/internal/pycore_unicodeobject_generated.h\nindex 6018d98d156..b1f411945e7 100644\n--- a/Include/internal/pycore_unicodeobject_generated.h\n+++ b/Include/internal/pycore_unicodeobject_generated.h\n@@ -1772,6 +1772,10 @@ _PyUnicode_InitStaticStrings(PyInterpreterState *interp) {\n _PyUnicode_InternStatic(interp, \u0026string);\n assert(_PyUnicode_CheckConsistency(string, 1));\n assert(PyUnicode_GET_LENGTH(string) != 1);\n+ string = \u0026_Py_ID(include_aliases);\n+ _PyUnicode_InternStatic(interp, \u0026string);\n+ assert(_PyUnicode_CheckConsistency(string, 1));\n+ assert(PyUnicode_GET_LENGTH(string) != 1);\n string = \u0026_Py_ID(incoming);\n _PyUnicode_InternStatic(interp, \u0026string);\n assert(_PyUnicode_CheckConsistency(string, 1));\n```\n\nBacktrace:\n```\nProgram received signal SIGSEGV, Segmentation fault.\n_PyUnicode_Equal (str1=0x555555c88c18 \u003c_PyRuntime+96088\u003e, str2=0x555555c88c50 \u003c_PyRuntime+96144\u003e) at ./Include/object.h:815\n815 return ((flags \u0026 feature) != 0);\n\n#0 _PyUnicode_Equal (str1=0x555555c88c18 \u003c_PyRuntime+96088\u003e, str2=0x555555c88c50 \u003c_PyRuntime+96144\u003e) at ./Include/object.h:815\n#1 0x00007ffff731df15 in ?? ()\n#2 0x00007ffff764a751 in ?? ()\n#3 0x0000555555cc2230 in _PyRuntime ()\n#4 0x00007fffffffbfc0 in ?? ()\n#5 0x00007ffff7317017 in ?? ()\n#6 0x0000555556053f60 in ?? ()\n#7 0x00007ffff7e2a9c8 in ?? ()\n#8 0x00007ffff7317000 in ?? ()\n#9 0x00007ffff7e2a910 in ?? ()\n#10 0x0000555555cc2230 in _PyRuntime ()\n#11 0x00005555557cdcf9 in _PyEval_EvalFrameDefault (tstate=\u003coptimized out\u003e, frame=0x58, throwflag=1291845632)\n at Python/generated_cases.c.h:7796\nBacktrace stopped: previous frame inner to this frame (corrupt stack?)\n```\n\nHere's the output from running `PYTHON_LLTRACE=4 ./python -m _pyrepl`:\n[lltrace_crash.txt](https://github.com/user-attachments/files/21497684/lltrace_crash.txt)\nAnd here for `PYTHON_OPT_DEBUG=4 ./python -m _pyrepl`:\n[opt_debug_crash.txt](https://github.com/user-attachments/files/21497685/opt_debug_crash.txt)\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.0a0 (heads/main-dirty:d7e12a362a2, Jul 29 2025, 18:24:07) [GCC 13.3.0]\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-137265\n* gh-139170\n* gh-139241\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/devdanzin","@type":"Person","name":"devdanzin"},"datePublished":"2025-07-29T21:49:12.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":16},"url":"https://github.com/137218/cpython/issues/137218"}
| 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:30af2241-4855-e6eb-3446-6e04796afc0f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BD70:12E713:3B9B4E:4C2FC9:696B4281 |
| html-safe-nonce | 6d0232d49257f6dafcbb27038567d079583d41c4fd834728442e68af183cfc63 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDcwOjEyRTcxMzozQjlCNEU6NEMyRkM5OjY5NkI0MjgxIiwidmlzaXRvcl9pZCI6IjYyNTUyODA0MTAwOTUyOTQ3MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5115359c9be8be3a5347358b10633c6a094c99e8813c20326c196164023c0eb1 |
| hovercard-subject-tag | issue:3275075882 |
| 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/137218/issue_layout |
| twitter:image | https://opengraph.githubassets.com/30d73b2fc0327f4db7ba3d235b3fe25a0603999c9ca9d1a3fa64c1b43bda2849/python/cpython/issues/137218 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/30d73b2fc0327f4db7ba3d235b3fe25a0603999c9ca9d1a3fa64c1b43bda2849/python/cpython/issues/137218 |
| og:image:alt | Crash report What happened? Edit: I'm seeing this crash even without patching JUMP_BACKWARD_INITIAL_VALUE. Will try to figure out a MRE for unpatched crash. If we #define JUMP_BACKWARD_INITIAL_VALU... |
| 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 | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| 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 | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width