Skip to content
16 changes: 6 additions & 10 deletions Lib/test/test_external_inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2068,23 +2068,19 @@ def test_empty_native_thread_stack(self):
"Test only runs on Linux with process_vm_readv support",
)
def test_popping_python_frame_is_not_native(self):
script = """\
script_body = """\
def leaf(depth):
if depth:
leaf(depth - 1)

while True:
leaf(300)
"""
with _managed_subprocess([sys.executable, "-c", script]) as process:
for _ in busy_retry(SHORT_TIMEOUT):
try:
unwinder = RemoteUnwinder(
process.pid, native=True, gc=False, cache_frames=False,
)
except RuntimeError:
continue
break

with self._target_process(script_body) as (process, _, _):
unwinder = RemoteUnwinder(
process.pid, native=True, gc=False, cache_frames=False,
)
# The unwinder can attach before the main loop starts.
_get_stack_trace_with_retry(
unwinder,
Expand Down
Loading