[3.14] gh-133741: Fix _can_strace(): check --trace option (GH-133766) (#133774)

gh-133741: Fix _can_strace(): check --trace option (GH-133766)

The --trace option needs strace 5.5 or newer.
(cherry picked from commit 67086282fc)

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Miss Islington (bot) 2025-05-09 18:52:23 +02:00 committed by GitHub
parent 4e57e213d6
commit 5e730a8baa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -178,7 +178,10 @@ def get_syscalls(code, strace_flags, prelude="", cleanup="",
# Moderately expensive (spawns a subprocess), so share results when possible.
@cache
def _can_strace():
res = strace_python("import sys; sys.exit(0)", [], check=False)
res = strace_python("import sys; sys.exit(0)",
# --trace option needs strace 5.5 (gh-133741)
["--trace=%process"],
check=False)
if res.strace_returncode == 0 and res.python_returncode == 0:
assert res.events(), "Should have parsed multiple calls"
return True