Skip to content

gh-160986: Fix flaky test_popping_python_frame_is_not_native - #161073

Open
asvetlov wants to merge 1 commit into
python:mainfrom
asvetlov:fix-flaky-popping-frame-test
Open

asvetlov wants to merge 1 commit into
python:mainfrom
asvetlov:fix-flaky-popping-frame-test

Conversation

@asvetlov

@asvetlov asvetlov commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

The remote unwinder can attach to the child process while it is still in interpreter startup, before it enters the while True: leaf(300) loop. On slow builds the fixed window of 10,000 samples can finish before leaf() ever runs, so the test fails with AssertionError: 0 not greater than 1000 (seen on buildbots and on the UBSan GHA job, e.g. https://github.com/python/cpython/actions/runs/41240245374/job/124652687585).

The test now waits (up to SHORT_TIMEOUT) until a sample contains leaf before starting the counted sampling loop. The sampling logic is factored into a small local helper so the wait and the counted loop share it. The assertion that a popping leaf frame is never reported as <native> is unchanged.

Supersedes the closed gh-160990. Test-only change, so no NEWS entry.

🤖 Generated with Claude Code

The unwinder can attach before the target process enters its main
loop, so on slow builds (e.g. UBSan) all 10,000 samples could be
taken before leaf() runs.  Wait until leaf() shows up in a sample
before counting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@asvetlov

asvetlov commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

@vstinner @pablogsal I've stuck with this CI error recently when I was working on another issue.
The fix is small and obvious; it increases CI stability, which is not very strong right now.

@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Nov 1, 2026
@asvetlov
asvetlov marked this pull request as ready for review November 1, 2026 09:53
@asvetlov
asvetlov requested a review from pablogsal November 1, 2026 09:53
@asvetlov
asvetlov requested a review from vstinner November 1, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant