Increase recursion limit (#1733)

This commit is contained in:
Hood Chatham 2021-07-23 15:03:05 +00:00 committed by GitHub
parent 986016a957
commit 6afbaa45fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -94,6 +94,13 @@ run_python_simple_inner(char* code)
int int
numpy_patch_init(); numpy_patch_init();
int
get_python_stack_depth()
{
PyThreadState* tstate = PyThreadState_GET();
return tstate->recursion_depth;
}
/** /**
* Bootstrap steps here: * Bootstrap steps here:
* 1. Initialize init_dict so that runPythonSimple will work. * 1. Initialize init_dict so that runPythonSimple will work.

View File

@ -154,7 +154,7 @@ function fixRecursionLimit() {
recurse(); recurse();
} catch (err) {} } catch (err) {}
let recursionLimit = Math.min(depth / 50, 400); let recursionLimit = Math.min(depth / 25, 500);
Module.runPythonSimple( Module.runPythonSimple(
`import sys; sys.setrecursionlimit(int(${recursionLimit}))` `import sys; sys.setrecursionlimit(int(${recursionLimit}))`
); );