]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.11] gh-108851: Fix tomllib recursion tests (#108853) (#109013)
authorVictor Stinner <vstinner@python.org>
Wed, 6 Sep 2023 16:40:39 +0000 (18:40 +0200)
committerGitHub <noreply@github.com>
Wed, 6 Sep 2023 16:40:39 +0000 (16:40 +0000)
commit95eb9849dd8004b3019f79a3973e2f431c5635cc
treef8ee4fdbc2b3b2fc8ed4583231d7ed8269839e12
parentd61b8f9b8b3e8c2fdb3f3f7a24149ca08270b573
[3.11] gh-108851: Fix tomllib recursion tests (#108853) (#109013)

gh-108851: Fix tomllib recursion tests (#108853)

* Add get_recursion_available() and get_recursion_depth() functions
  to the test.support module.
* Change infinite_recursion() default max_depth from 75 to 100.
* Fix test_tomllib recursion tests for WASI buildbots: reduce the
  recursion limit and compute the maximum nested array/dict depending
  on the current available recursion limit.
* test.pythoninfo logs sys.getrecursionlimit().
* Enhance test_sys tests on sys.getrecursionlimit()
  and sys.setrecursionlimit().

Backport notes:

* Set support.infinite_recursion() minimum to 4 frames.
* test_support.test_get_recursion_depth() uses limit-2, apparently
  f-string counts for 2 frames in Python 3.11.
* test_sys.test_setrecursionlimit_to_depth() tests depth+2 instead of
  depth+1.

(cherry picked from commit 8ff11425783806f8cb78e99f667546b1f7f3428e)
Lib/test/pythoninfo.py
Lib/test/support/__init__.py
Lib/test/test_support.py
Lib/test/test_sys.py
Lib/test/test_tomllib/test_misc.py
Misc/NEWS.d/next/Tests/2023-09-03-21-18-35.gh-issue-108851.CCuHyI.rst [new file with mode: 0644]
Misc/NEWS.d/next/Tests/2023-09-03-21-41-10.gh-issue-108851.xFTYOE.rst [new file with mode: 0644]