Skip to content

Commit 921de8f

Browse files
tanloongvstinner
andauthored
gh-162251: Fix external inspection test_popping_python_frame_is_not_native() (#162268)
Wait for child execve() before creating `RemoteUnwinder`. Use _target_processing() to sync with the child process. Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent d1e3cae commit 921de8f

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

‎Lib/test/test_external_inspection.py‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,23 +2068,19 @@ def test_empty_native_thread_stack(self):
20682068
"Test only runs on Linux with process_vm_readv support",
20692069
)
20702070
def test_popping_python_frame_is_not_native(self):
2071-
script = """\
2071+
script_body = """\
20722072
def leaf(depth):
20732073
if depth:
20742074
leaf(depth - 1)
20752075
20762076
while True:
20772077
leaf(300)
20782078
"""
2079-
with _managed_subprocess([sys.executable, "-c", script]) as process:
2080-
for _ in busy_retry(SHORT_TIMEOUT):
2081-
try:
2082-
unwinder = RemoteUnwinder(
2083-
process.pid, native=True, gc=False, cache_frames=False,
2084-
)
2085-
except RuntimeError:
2086-
continue
2087-
break
2079+
2080+
with self._target_process(script_body) as (process, _, _):
2081+
unwinder = RemoteUnwinder(
2082+
process.pid, native=True, gc=False, cache_frames=False,
2083+
)
20882084
# The unwinder can attach before the main loop starts.
20892085
_get_stack_trace_with_retry(
20902086
unwinder,

0 commit comments

Comments
 (0)