https://github.com/python/cpython/commit/9967b568edd2e35b0415c14c7242f3ca2c0dc03d
commit: 9967b568edd2e35b0415c14c7242f3ca2c0dc03d
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2024-03-23T13:01:20+01:00
summary:
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.
files:
M Include/cpython/pystate.h
M Lib/test/test_functools.py
diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h
index f1540fde925921..7fb6b176392173 100644
--- a/Include/cpython/pystate.h
+++ b/Include/cpython/pystate.h
@@ -209,6 +209,8 @@ struct _ts {
# define Py_C_RECURSION_LIMIT 500
#elif defined(__s390x__)
# define Py_C_RECURSION_LIMIT 800
+#elif defined(_WIN32) && defined(_M_ARM64)
+# define Py_C_RECURSION_LIMIT 1000
#elif defined(_WIN32)
# define Py_C_RECURSION_LIMIT 3000
#elif defined(__ANDROID__)
diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py
index 1a6d8afe6ed6fe..3ba4929dd1b133 100644
--- a/Lib/test/test_functools.py
+++ b/Lib/test/test_functools.py
@@ -334,8 +334,10 @@ def test_recursive_pickle(self):
f.__setstate__((f, (), {}, {}))
try:
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
- with self.assertRaises(RecursionError):
- pickle.dumps(f, proto)
+ # gh-117008: Small limit since pickle uses C stack memory
+ with support.infinite_recursion(100):
+ with self.assertRaises(RecursionError):
+ pickle.dumps(f, proto)
finally:
f.__setstate__((capture, (), {}, {}))
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]