mirror of https://github.com/pyodide/pyodide.git
Increase recursion limit (#1733)
This commit is contained in:
parent
986016a957
commit
6afbaa45fc
|
@ -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.
|
||||||
|
|
|
@ -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}))`
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue