Skip to content
This repository was archived by the owner on Apr 17, 2024. It is now read-only.

Commit 92dcf00

Browse files
morambrocopybara-github
authored andcommitted
Increase the number of recursions to 1500 to test recursion limits for JSON
This is needed because 3.12 increased the C recursion limit to 1500 (python/cpython#107618). PiperOrigin-RevId: 625319033
1 parent a5a996a commit 92dcf00

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

python/tink/jwt/_json_util_test.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"""Tests for tink.python.tink.jwt._json_util."""
1515

1616
from absl.testing import absltest
17+
1718
from tink.jwt import _json_util
1819
from tink.jwt import _jwt_error
1920

@@ -37,7 +38,10 @@ def test_json_loads_duplidate_entries_fails(self):
3738
_json_util.json_loads('{"a":"a1", "a":"a2"}')
3839

3940
def test_json_loads_recursion(self):
40-
num_recursions = 1000
41+
# NOTE: Python 3.12 has raised the maximum C recursion limit to 1500 [1].
42+
#
43+
# [1] https://github.com/python/cpython/pull/107618
44+
num_recursions = 2000
4145
recursive_json = ('{"a":' * num_recursions) + '""' + ('}' * num_recursions)
4246
with self.assertRaises(_jwt_error.JwtInvalidError):
4347
_json_util.json_loads(recursive_json)

0 commit comments

Comments
 (0)