Skip to content

Commit

Permalink
restore test_stack_overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fjetter committed Mar 10, 2023
1 parent a1f1f56 commit a6a174d
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions distributed/tests/test_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,19 +356,25 @@ def test_call_stack_f_lineno(f_lasti: int, f_lineno: int) -> None:


def test_stack_overflow():
state = create()
frame = None

def f(i):
if i == 0:
nonlocal frame
frame = sys._current_frames()[threading.get_ident()]
return
else:
return f(i - 1)

f(sys.getrecursionlimit() - 200)
process(frame, None, state)
assert state["children"]
assert state["count"]
assert merge(state, state, state)
old = sys.getrecursionlimit()
sys.setrecursionlimit(200)
try:
state = create()
frame = None

def f(i):
if i == 0:
nonlocal frame
frame = sys._current_frames()[threading.get_ident()]
return
else:
return f(i - 1)

f(sys.getrecursionlimit() - 200)
process(frame, None, state)
assert state["children"]
assert state["count"]
assert merge(state, state, state)

finally:
sys.setrecursionlimit(old)

0 comments on commit a6a174d

Please sign in to comment.