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):
222
222
# Create a deeply nested structure.
223
223
head = last = []
224
224
# 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' :
226
229
MAX_MARSHAL_STACK_DEPTH = 1000
227
230
else :
228
231
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
25
25
* and risks coring the interpreter. When the object stack gets this deep,
26
26
* raise an exception instead of continuing.
27
27
* 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)
28
34
*/
29
- #if defined(MS_WINDOWS ) && defined( _DEBUG )
35
+ #if defined(MS_WINDOWS )
30
36
#define MAX_MARSHAL_STACK_DEPTH 1000
31
37
#else
32
38
#define MAX_MARSHAL_STACK_DEPTH 2000
You can’t perform that action at this time.
0 commit comments