Commit 580c3cd
fix: make deeply-nested-body test platform-independent (#3146)
Since CPython 3.12 the C json scanner guards recursion by remaining
C-stack headroom rather than a fixed depth, so whether a 100k-deep
body raises RecursionError (-> PARSE_ERROR) or parses into a giant
list that fails request validation (-> INVALID_REQUEST) depends on
the thread's stack size. macOS threads run with a smaller default
stack, which is why the test failed there while passing on Ubuntu
and Windows.
Split the test in two: the nested-body test now asserts a 400 with
either rejection code (both are correct; neither is a crash), and a
new monkeypatch-based test pins the RecursionError -> PARSE_ERROR
mapping deterministically on every platform.
Fixes #31461 parent 3a6f299 commit 580c3cd
1 file changed
Lines changed: 27 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1008 | 1008 | | |
1009 | 1009 | | |
1010 | 1010 | | |
1011 | | - | |
1012 | | - | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
1013 | 1021 | | |
1014 | 1022 | | |
1015 | 1023 | | |
1016 | 1024 | | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
1017 | 1042 | | |
1018 | 1043 | | |
1019 | 1044 | | |
| |||
0 commit comments