https://github.com/python/cpython/commit/f7ab4ebb2cbff20b5f20c3547a3a4d1f69fe6cf9 commit: f7ab4ebb2cbff20b5f20c3547a3a4d1f69fe6cf9 branch: 3.13 author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com> committer: hugovk <1324225+hug...@users.noreply.github.com> date: 2025-04-06T12:28:22+03:00 summary:
[3.13] gh-132038: Make perf version check in test_perf_profiler more robust (GH-132039) (#132058) gh-132038: Make perf version check in test_perf_profiler more robust (GH-132039) Should work also if the version string includes a commit hash, like `perf version 6.12.9.g242e6068fd5c` (cherry picked from commit b6c92ec419cfa1e4483b072996bab403c9970a5d) Co-authored-by: Itamar Oren <itamar...@gmail.com> files: M Lib/test/test_perf_profiler.py diff --git a/Lib/test/test_perf_profiler.py b/Lib/test/test_perf_profiler.py index 7c1bbeed168d2e..778d4db65b14c5 100644 --- a/Lib/test/test_perf_profiler.py +++ b/Lib/test/test_perf_profiler.py @@ -482,7 +482,8 @@ def compile_trampolines_for_all_functions(): def _is_perf_vesion_at_least(major, minor): # The output of perf --version looks like "perf version 6.7-3" but - # it can also be perf version "perf version 5.15.143" + # it can also be perf version "perf version 5.15.143", or even include + # a commit hash in the version string, like "6.12.9.g242e6068fd5c" try: output = subprocess.check_output(["perf", "--version"], text=True) except (subprocess.CalledProcessError, FileNotFoundError): @@ -490,7 +491,7 @@ def _is_perf_vesion_at_least(major, minor): version = output.split()[2] version = version.split("-")[0] version = version.split(".") - version = tuple(map(int, version)) + version = tuple(map(int, version[:2])) return version >= (major, minor) _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com