Skip to content

gh-158314: Fix test_parameters_deep_recursion on 32-bit ARM - #161847

Open
aozmekik wants to merge 1 commit into
python:mainfrom
aozmekik:gh-158314-deep-parameters
Open

aozmekik wants to merge 1 commit into
python:mainfrom
aozmekik:gh-158314-deep-parameters

Conversation

@aozmekik

@aozmekik aozmekik commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

On 32-bit ARM, _Py_make_parameters() takes only 48 bytes of C stack per level in a debug build, so the 150,000 nested lists fit in the 8 MiB stack of run_with_limited_c_stack() and no RecursionError is raised. The 3.14 release build and 3.15 still pass on armhf, but only just: they overflow at about 149,400 and 149,100 levels.

This nests 500,000 levels instead, the same depth other tests with small C frames use (test_exceptions, test_xml_etree, test_compile).

I ran it with Debian sid's python3.14 and python3.15, debug and release, on amd64, i386, armhf, arm64, ppc64el, s390x and riscv64. Before this change it failed only with python3.14-dbg on armhf. With it, it passes on all of them. On the other architectures a level takes 80 bytes or more. I also ran test_typing from main and 3.14 source builds, debug (with -R 3:3) and release, with ulimit -s from 1 MiB to unlimited. The test's peak memory goes up by about 25 MB in a release build.

The 3.14 backport will conflict in the import list, so I can do that one by hand.

_Py_make_parameters() uses only 48 bytes of C stack per level in a debug
build on 32-bit ARM, so 150_000 nested lists fit in the 8 MiB stack of
run_with_limited_c_stack() and no RecursionError is raised.  Nest
500_000 levels, as other tests with small C frames do.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant