Skip to content

gh-98894: Check readelf failures in test_dtrace - #152345

Merged
vstinner merged 2 commits into
python:mainfrom
stratakis:readelf_errors
Jul 2, 2026
Merged

gh-98894: Check readelf failures in test_dtrace#152345
vstinner merged 2 commits into
python:mainfrom
stratakis:readelf_errors

Conversation

@stratakis

@stratakisstratakis commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Report readelf command failures directly instead of later failing with missing-probe assertions.

Report readelf command failures directly instead of later failing with
missing-probe assertions.
@bedevere-appbedevere-appBot added the tests Tests in the Lib/test dir label Jun 26, 2026
@stratakis

Copy link
Copy Markdown
ContributorAuthor

cc @vstinner

@vstinnervstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_readelf_version() and get_readelf_output() share most code to spawn the subprocess. Can you move the common code into a run_readelf(command) function?

Something like:

def run_readelf(cmd):
# Force the C locale to disable localization.
env = dict(os.environ, LC_ALL="C")
proc = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
env=env,
)
with proc:
stdout, stderr = proc.communicate()
if proc.returncode:
raise AssertionError(
f"Command {' '.join(cmd)!r} failed "
f"with exit code {proc.returncode}: "
f"stdout={version!r} stderr={stderr!r}"
)
return stdout

You can replace legacy universal_newlines=True with text=True :-)

@vstinnervstinner added skip news needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jul 2, 2026
@vstinner
vstinner enabled auto-merge (squash) July 2, 2026 13:17
@vstinner
vstinner merged commit d60a677 into python:mainJul 2, 2026
56 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @stratakis for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Sorry, @stratakis and @vstinner, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker d60a6779e8dd5fbf1f2f84b34bb5a20f3e8cd7fd 3.14

@miss-islington-app

Copy link
Copy Markdown

Sorry, @stratakis and @vstinner, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker d60a6779e8dd5fbf1f2f84b34bb5a20f3e8cd7fd 3.13

@bedevere-app

Copy link
Copy Markdown

GH-152891 is a backport of this pull request to the 3.15 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jul 2, 2026
@stratakis

Copy link
Copy Markdown
ContributorAuthor

3.14 and 3.13 are not relevant here due to the dtrace support not being there in a proper way (it will to be backported fully from #142397 )

@vstinnervstinner removed needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jul 2, 2026
@vstinner

Copy link
Copy Markdown
Member

Merged, thanks for your fix.

3.14 and 3.13 are not relevant here due to the dtrace support not being there in a proper way (it will to be backported fully from #142397 )

Oh ok. No 3.13 and 3.14 backport in this case.

vstinner pushed a commit that referenced this pull request Jul 2, 2026
…152891)
gh-98894: Check readelf failures in test_dtrace (GH-152345)
Report readelf command failures directly instead of later failing with
missing-probe assertions.
(cherry picked from commit d60a677)
Co-authored-by: stratakis <cstratak@redhat.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newstestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@stratakis@vstinner