Skip to content

tests: lower test_elif_deep depth from 1000 to 100#2146

Open
amaanq wants to merge 1 commit intopallets:mainfrom
amaanq:fix-elif-deep-s390x
Open

tests: lower test_elif_deep depth from 1000 to 100#2146
amaanq wants to merge 1 commit intopallets:mainfrom
amaanq:fix-elif-deep-s390x

Conversation

@amaanq
Copy link

@amaanq amaanq commented Mar 18, 2026

The flat elif codegen (#759) is unconditional, so even a handful of branches exercises the codepath. On s390x, CPython sets Py_C_RECURSION_LIMIT to just 800 because the z/Architecture ABI requires a 160-byte register save area per call frame, roughly 10x what x86_64 needs, which makes 1000 nested branches overflow compile() with a RecursionError. Lowering to 100 still thoroughly exercises the flat elif codepath while staying within all platform limits.

The flat `elif` codegen (pallets#759) is unconditional, so even a handful of
branches exercises the codepath. On s390x, CPython sets
`Py_C_RECURSION_LIMIT` to just 800 because the z/Architecture ABI
requires a 160-byte register save area per call frame, roughly 10x
what x86_64 needs, which makes 1000 nested branches overflow
`compile()` with a `RecursionError`. Lowering to 100 still thoroughly
exercises the flat elif codepath while staying within all platform
limits.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_elif_deep fails on s390x with RecursionError

1 participant