Skip to content
Snippets Groups Projects
Commit a8225b0e authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

let setrlimit fail :/

parent cc70a9cd
No related branches found
No related tags found
1 merge request!278Port to Python 3
......@@ -36,7 +36,12 @@ def less_limited_stack():
More precisely, the soft stack limit is raised to the hard limit.
"""
soft, hard = getrlimit(RLIMIT_STACK)
# We can raise the soft limit to the hard limit and no higher.
setrlimit(RLIMIT_STACK, (hard, hard))
yield
setrlimit(RLIMIT_STACK, (soft, hard))
try:
# We can raise the soft limit to the hard limit and no higher.
setrlimit(RLIMIT_STACK, (hard, hard))
except ValueError:
# Well, not on macOS: https://bugs.python.org/issue34602
yield
else:
yield
setrlimit(RLIMIT_STACK, (soft, hard))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment