From d1a6bfa7b500ab86e140409384633a67945ac8a7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 4 Jan 2023 15:58:41 +0530 Subject: [PATCH] Windows build: Double the stack size Python assumes a stack size of 2MB on windows. The windows default is 1MB. Presumably whoever builds python.exe changes it. Do the same to avoid crashes due to too much recursion. Fixes #2000888 [BS4 str(soup) crashes Calibre instead of raising RecursionError](https://bugs.launchpad.net/calibre/+bug/2000888) --- bypy/windows/__main__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bypy/windows/__main__.py b/bypy/windows/__main__.py index fc62b117b6..c9bd1c7d83 100644 --- a/bypy/windows/__main__.py +++ b/bypy/windows/__main__.py @@ -496,6 +496,7 @@ def build_launchers(env, incdir, debug=False): '/LIBPATH:' + env.obj_dir, '/SUBSYSTEM:' + subsys, '/LIBPATH:%s/libs' % env.python_base, '/RELEASE', '/MANIFEST:EMBED', '/MANIFESTINPUT:' + mf, + '/STACK:2097152', # Set stack size to 2MB which is what python expects. Default on windows is 1MB 'user32.lib', 'kernel32.lib', '/OUT:' + exe] + u32 + dlflags + [embed_resources(env, exe), dest, lib] run(*cmd)