Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
PyPy
pypy
Commits
da8096b43023
Commit
7dd87bd1
authored
Oct 25, 2019
by
Armin Rigo
Browse files
Issue
#3094
Simple workaround for programs calling 'sys.setrecursionlimit(huge_value)'
parent
ce2c72abde3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
pypy/module/sys/vm.py
View file @
da8096b4
...
@@ -59,6 +59,12 @@ threads you can configure the limit by calling "threading.stack_size()".
...
@@ -59,6 +59,12 @@ threads you can configure the limit by calling "threading.stack_size()".
from
rpython.rlib.rgc
import
increase_root_stack_depth
from
rpython.rlib.rgc
import
increase_root_stack_depth
if
new_limit
<=
0
:
if
new_limit
<=
0
:
raise
oefmt
(
space
.
w_ValueError
,
"recursion limit must be positive"
)
raise
oefmt
(
space
.
w_ValueError
,
"recursion limit must be positive"
)
# Some programs use very large values to mean "don't check, I want to
# use as much as possible and then segfault". Add a silent upper bound
# of 10**6 here, because huge values cause huge shadowstacks to be
# allocated (or MemoryErrors).
if
new_limit
>
1000000
:
new_limit
=
1000000
space
.
sys
.
recursionlimit
=
new_limit
space
.
sys
.
recursionlimit
=
new_limit
_stack_set_length_fraction
(
new_limit
*
0.001
)
_stack_set_length_fraction
(
new_limit
*
0.001
)
increase_root_stack_depth
(
int
(
new_limit
*
0.001
*
163840
))
increase_root_stack_depth
(
int
(
new_limit
*
0.001
*
163840
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment