Commit 1956ff6
test: correct docstring per review measurements; assert exact PARSE_ERROR below 3.14
Review measurements on #3147 (and re-measured here on arm64 macOS) show the
stack-headroom-based recursion guard in the C json scanner starts in CPython
3.14, not 3.12 - on 3.12/3.13 the flip depth is identical across 8/16/64 MB
stacks. Docstring updated accordingly.
The macOS mechanism was also backwards in the old docstring: it is not a
smaller thread stack but a larger one. CPython pins non-main threads to a
16 MiB stack on macOS (THREAD_STACK_SIZE in Python/thread_pthread.h);
measured default-thread flip on arm64 macOS 3.14 is ~149,641 levels -
identical to an explicit 16 MiB stack - so the 100k-deep body parses and
fails validation (INVALID_REQUEST) instead of raising RecursionError.
Since the outcome is deterministic below 3.14, the test now asserts the
exact PARSE_ERROR code there and accepts either rejection only on 3.14+.1 parent 580c3cd commit 1956ff6
1 file changed
Lines changed: 18 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
1011 | 1012 | | |
1012 | 1013 | | |
1013 | 1014 | | |
1014 | | - | |
1015 | | - | |
1016 | | - | |
1017 | | - | |
1018 | | - | |
1019 | | - | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
1020 | 1028 | | |
1021 | 1029 | | |
1022 | 1030 | | |
1023 | 1031 | | |
1024 | 1032 | | |
1025 | | - | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
1026 | 1037 | | |
1027 | 1038 | | |
1028 | 1039 | | |
| |||
0 commit comments