From 56e59a49ae4d9f518c5cc918aefe7eeee11736b4 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Mon, 20 Nov 2023 05:27:33 -0800 Subject: GH-111807: Lower the parser stack depth under WASI debug builds (#112225) --- .../2023-11-17-16-49-32.gh-issue-111807.QvjP9_.rst | 1 + Parser/parser.c | 6 +++++- Tools/peg_generator/pegen/c_generator.py | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2023-11-17-16-49-32.gh-issue-111807.QvjP9_.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-11-17-16-49-32.gh-issue-111807.QvjP9_.rst b/Misc/NEWS.d/next/Core and Builtins/2023-11-17-16-49-32.gh-issue-111807.QvjP9_.rst new file mode 100644 index 0000000..6f07584 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-11-17-16-49-32.gh-issue-111807.QvjP9_.rst @@ -0,0 +1 @@ +Lower the max parser stack depth to 1000 under WASI debug builds. diff --git a/Parser/parser.c b/Parser/parser.c index ca8e9d0..d27ddd3 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -8,7 +8,11 @@ #endif #ifdef __wasi__ -# define MAXSTACK 4000 +# ifdef Py_DEBUG +# define MAXSTACK 1000 +# else +# define MAXSTACK 4000 +# endif #else # define MAXSTACK 6000 #endif diff --git a/Tools/peg_generator/pegen/c_generator.py b/Tools/peg_generator/pegen/c_generator.py index 301949b..7cdd5de 100644 --- a/Tools/peg_generator/pegen/c_generator.py +++ b/Tools/peg_generator/pegen/c_generator.py @@ -38,7 +38,11 @@ EXTENSION_PREFIX = """\ #endif #ifdef __wasi__ -# define MAXSTACK 4000 +# ifdef Py_DEBUG +# define MAXSTACK 1000 +# else +# define MAXSTACK 4000 +# endif #else # define MAXSTACK 6000 #endif -- cgit v0.12