Skip to content

Commit

Permalink
Use a larger number of recursions in JwtFormatTest
Browse files Browse the repository at this point in the history
Using 2000 currently fails on Windows. This is the same value as in https://github.com/python/cpython/blob/v3.12.3/Lib/test/support/__init__.py#L2367.

PiperOrigin-RevId: 629343279
Change-Id: If358f3636eb9789cd4e51f271c8a69056f647b6c
  • Loading branch information
morambro authored and copybara-github committed Apr 30, 2024
1 parent 26b93a4 commit 1842093
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tink/jwt/_json_util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ def test_json_loads_duplidate_entries_fails(self):
_json_util.json_loads('{"a":"a1", "a":"a2"}')

def test_json_loads_recursion(self):
# NOTE: Python 3.12 has raised the maximum C recursion limit to 1500 [1].
#
# [1] https://github.com/python/cpython/pull/107618
num_recursions = 2000
# Value from
# https://github.com/python/cpython/blob/v3.12.3/Lib/test/support/__init__.py#L2367.
num_recursions = 5000
recursive_json = ('{"a":' * num_recursions) + '""' + ('}' * num_recursions)
with self.assertRaises(_jwt_error.JwtInvalidError):
_json_util.json_loads(recursive_json)
Expand Down

0 comments on commit 1842093

Please sign in to comment.