Title: Py_C_STACK_SIZE causes `test_max_level` failure on musl/s390x · Issue #139467 · python/cpython · GitHub
Open Graph Title: Py_C_STACK_SIZE causes `test_max_level` failure on musl/s390x · Issue #139467 · python/cpython
X Title: Py_C_STACK_SIZE causes `test_max_level` failure on musl/s390x · Issue #139467 · python/cpython
Description: Bug report Bug description: Hello, I am updating Python in Alpine to 3.14 and encountered the following test failure on s390x: ====================================================================== ERROR: test_max_level (test.test_gramma...
Open Graph Description: Bug report Bug description: Hello, I am updating Python in Alpine to 3.14 and encountered the following test failure on s390x: ======================================================================...
X Description: Bug report Bug description: Hello, I am updating Python in Alpine to 3.14 and encountered the following test failure on s390x: ======================================================================...
Opengraph URL: https://github.com/python/cpython/issues/139467
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Py_C_STACK_SIZE causes `test_max_level` failure on musl/s390x","articleBody":"# Bug report\n\n### Bug description:\n\nHello,\n\nI am [updating Python in Alpine to 3.14](https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/90482) and encountered the following test failure on s390x:\n\n```\n======================================================================\nERROR: test_max_level (test.test_grammar.TokenTests.test_max_level)\n----------------------------------------------------------------------\nTraceback (most recent call last):\n File \"/builds/lotheac/aports/main/python3/src/Python-3.14.0rc3/Lib/test/test_grammar.py\", line 257, in test_max_level\n result = eval(\"(\" * MAXLEVEL + \")\" * MAXLEVEL)\nMemoryError: Parser stack overflowed - Python source too complex to parse\n\n----------------------------------------------------------------------\n```\n\nthe root cause seems to be the following define in `Python/ceval.c`, added in commit 014223649c33b2febbccfa221c2ab7f18a8c0847:\n```\n#if defined(__s390x__)\n# define Py_C_STACK_SIZE 320000\n```\n\nI was able to make the tests pass by removing this stack size limitation for s390x with the following patch, making it use the default size `4000000` as other architectures do:\n```\ndiff --git a/Python/ceval.c b/Python/ceval.c\nindex e5b1b82e45e..fe8c4a7d092 100644\n--- a/Python/ceval.c\n+++ b/Python/ceval.c\n@@ -352,7 +352,7 @@ _Py_EnterRecursiveCallUnchecked(PyThreadState *tstate)\n }\n }\n\n-#if defined(__s390x__)\n+#if 0\n # define Py_C_STACK_SIZE 320000\n #elif defined(_WIN32)\n // Don't define Py_C_STACK_SIZE, ask the O/S\n```\n\nBecause this dumb patch appears to work, I would like to ask you for some insight on why this `Py_C_STACK_SIZE` override on s390x exists. I'm not very familiar with s390x myself.\n\n### CPython versions tested on:\n\n3.14\n\n### Operating systems tested on:\n\nLinux","author":{"url":"https://github.com/lotheac","@type":"Person","name":"lotheac"},"datePublished":"2025-10-01T05:44:12Z","url":"https://github.com/python/cpython/issues/139467"}
| 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:707a4bf7-66c4-8404-c15b-299aeb1c9f80 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D96E:24645:18C77EB:20A4CB2:6B020E10 |
| html-safe-nonce | bec4d1299eb1ae98cbb88ec600f8a8cc5da04cb4ad6a4e58f0b068fd050a1bed |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTZFOjI0NjQ1OjE4Qzc3RUI6MjBBNENCMjo2QjAyMEUxMCIsInZpc2l0b3JfaWQiOiIzOTY5MTA3ODA2OTI1MjI5NTg0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8d41156c0f66f17be1e97656d1d842c1e642b30daed89668564ae16bc4e464a3 |
| hovercard-subject-tag | issue:3472124192 |
| 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/139467/issue_layout |
| twitter:image | https://opengraph.githubassets.com/158790e46dffdce8b7e2593b883a036e43be6ec1c8d01c46e77ec0e4cfc57755/python/cpython/issues/139467 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/158790e46dffdce8b7e2593b883a036e43be6ec1c8d01c46e77ec0e4cfc57755/python/cpython/issues/139467 |
| og:image:alt | Bug report Bug description: Hello, I am updating Python in Alpine to 3.14 and encountered the following test failure on s390x: ======================================================================... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lotheac |
| 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