Kaydet (Commit) 64c82753 authored tarafından Benjamin Peterson's avatar Benjamin Peterson

reduce marshal stack size in debug mode on windows (closes #27019)

üst ee69451f
...@@ -234,7 +234,10 @@ class BugsTestCase(unittest.TestCase): ...@@ -234,7 +234,10 @@ class BugsTestCase(unittest.TestCase):
# Create a deeply nested structure. # Create a deeply nested structure.
head = last = [] head = last = []
# The max stack depth should match the value in Python/marshal.c. # 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): for i in range(MAX_MARSHAL_STACK_DEPTH - 2):
last.append([0]) last.append([0])
last = last[-1] last = last[-1]
......
...@@ -16,8 +16,13 @@ ...@@ -16,8 +16,13 @@
/* High water mark to determine when the marshalled object is dangerously deep /* High water mark to determine when the marshalled object is dangerously deep
* and risks coring the interpreter. When the object stack gets this deep, * and risks coring the interpreter. When the object stack gets this deep,
* raise an exception instead of continuing. * 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 #define MAX_MARSHAL_STACK_DEPTH 2000
#endif
#define TYPE_NULL '0' #define TYPE_NULL '0'
#define TYPE_NONE 'N' #define TYPE_NONE 'N'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment