gh-117008: Fix functools test_recursive_pickle() (#117009)

Use support.infinite_recursion() in test_recursive_pickle() of
test_functools to prevent a stack overflow on "ARM64 Windows
Non-Debug" buildbot.

Lower Py_C_RECURSION_LIMIT to 1,000 frames on Windows ARM64.
This commit is contained in:
Victor Stinner 2024-03-23 13:01:20 +01:00 committed by GitHub
parent 72eea512b8
commit 9967b568ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -209,6 +209,8 @@ struct _ts {
# define Py_C_RECURSION_LIMIT 500 # define Py_C_RECURSION_LIMIT 500
#elif defined(__s390x__) #elif defined(__s390x__)
# define Py_C_RECURSION_LIMIT 800 # define Py_C_RECURSION_LIMIT 800
#elif defined(_WIN32) && defined(_M_ARM64)
# define Py_C_RECURSION_LIMIT 1000
#elif defined(_WIN32) #elif defined(_WIN32)
# define Py_C_RECURSION_LIMIT 3000 # define Py_C_RECURSION_LIMIT 3000
#elif defined(__ANDROID__) #elif defined(__ANDROID__)

View File

@ -334,6 +334,8 @@ class TestPartial:
f.__setstate__((f, (), {}, {})) f.__setstate__((f, (), {}, {}))
try: try:
for proto in range(pickle.HIGHEST_PROTOCOL + 1): for proto in range(pickle.HIGHEST_PROTOCOL + 1):
# gh-117008: Small limit since pickle uses C stack memory
with support.infinite_recursion(100):
with self.assertRaises(RecursionError): with self.assertRaises(RecursionError):
pickle.dumps(f, proto) pickle.dumps(f, proto)
finally: finally: