diff -r 10c3d1527e88 Lib/test/test_marshal.py --- a/Lib/test/test_marshal.py Sat May 14 07:25:37 2016 +0000 +++ b/Lib/test/test_marshal.py Sat May 14 17:28:03 2016 +0100 @@ -234,7 +234,10 @@ # 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] diff -r 10c3d1527e88 Python/marshal.c --- a/Python/marshal.c Sat May 14 07:25:37 2016 +0000 +++ b/Python/marshal.c Sat May 14 17:28:03 2016 +0100 @@ -16,8 +16,13 @@ /* 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'