File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -222,7 +222,10 @@ def test_recursion_limit(self):
222222 # Create a deeply nested structure.
223223 head = last = []
224224 # The max stack depth should match the value in Python/marshal.c.
225- if os .name == 'nt' and hasattr (sys , 'gettotalrefcount' ):
225+ # BUG: https://bugs.python.org/issue33720
226+ # Windows always limits the maximum depth on release and debug builds
227+ #if os.name == 'nt' and hasattr(sys, 'gettotalrefcount'):
228+ if os .name == 'nt' :
226229 MAX_MARSHAL_STACK_DEPTH = 1000
227230 else :
228231 MAX_MARSHAL_STACK_DEPTH = 2000
Original file line number Diff line number Diff line change 1+ Reduces maximum marshal recursion depth on release builds.
Original file line number Diff line number Diff line change @@ -25,8 +25,14 @@ module marshal
2525 * and risks coring the interpreter. When the object stack gets this deep,
2626 * raise an exception instead of continuing.
2727 * On Windows debug builds, reduce this value.
28+ *
29+ * BUG: https://bugs.python.org/issue33720
30+ * On Windows PGO builds, the r_object function overallocates its stack and
31+ * can cause a stack overflow. We reduce the maximum depth for all Windows
32+ * releases to protect against this.
33+ * #if defined(MS_WINDOWS) && defined(_DEBUG)
2834 */
29- #if defined(MS_WINDOWS ) && defined( _DEBUG )
35+ #if defined(MS_WINDOWS )
3036#define MAX_MARSHAL_STACK_DEPTH 1000
3137#else
3238#define MAX_MARSHAL_STACK_DEPTH 2000
You can’t perform that action at this time.
0 commit comments