]> granicus.if.org Git - python/commitdiff
reduce marshal stack size in debug mode on windows (closes #27019)
authorBenjamin Peterson <benjamin@python.org>
Thu, 7 Jul 2016 06:37:02 +0000 (23:37 -0700)
committerBenjamin Peterson <benjamin@python.org>
Thu, 7 Jul 2016 06:37:02 +0000 (23:37 -0700)
Lib/test/test_marshal.py
Python/marshal.c

index 1967c4807ea3c71276a15d0612196c2d025451a1..76d59bac392a0fa5055a3086ef78fb32618e0a3b 100644 (file)
@@ -234,7 +234,10 @@ class BugsTestCase(unittest.TestCase):
         # Create a deeply nested structure.
         head = last = []
         # The max stack depth should match the value in Python/marshal.c.
-        MAX_MARSHAL_STACK_DEPTH = 2000
+        if os.name == 'nt' and hasattr(sys, 'gettotalrefcount'):
+            MAX_MARSHAL_STACK_DEPTH = 1000
+        else:
+            MAX_MARSHAL_STACK_DEPTH = 2000
         for i in range(MAX_MARSHAL_STACK_DEPTH - 2):
             last.append([0])
             last = last[-1]
index 6b285aaa41ed30d6450f4628908bf088687b37c7..e1a84d0bf7175cca0bfe3d706bd7997fbf271517 100644 (file)
 /* High water mark to determine when the marshalled object is dangerously deep
  * and risks coring the interpreter.  When the object stack gets this deep,
  * raise an exception instead of continuing.
+ * On Windows debug builds, reduce this value.
  */
+#if defined(MS_WINDOWS) && defined(_DEBUG)
+#define MAX_MARSHAL_STACK_DEPTH 1000
+#else
 #define MAX_MARSHAL_STACK_DEPTH 2000
+#endif
 
 #define TYPE_NULL               '0'
 #define TYPE_NONE               'N'