fix(tools): keep overlap tests compatible with Python 3.9 #6734
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6734"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T08:25:43Z.
What
Path.write_text(..., newline=...)is only available starting in Python 3.10.tools/tests/test_pr_overlap.pyis registered with CTest, so these fixture writes raiseTypeErrorwhen the tool test suite runs on Python 3.9. The three affected fixtures intentionally use exact UTF-8/LF bytes; write them withPath.write_bytes(data.encode("utf-8"))instead.Python documents the
newlineparameter as added in 3.10: https://docs.python.org/3.10/library/pathlib.html#pathlib.Path.write_textTested
Linux, Python 3.11.2:
python3 -m unittest tools.tests.test_pr_overlap -v— 21 tests passed.python3 tools/check_conventions.py --base upstream/main --head HEAD— passed.git diff --check— passed.python3 tools/pr_overlap.py --branch codex/python39-test-fixture-writes— no overlap with open pull requests.Python 3.9 itself was not available in this environment; compatibility follows from using
Path.write_bytes, which predates Python 3.9, and removing the 3.10-only argument. No C++ build was run because this changes only a Python test.Checklist
main; no other open PR implements the same changeImported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T09:33:49Z.
Review: COMMENTED
Ran this with the Python 3.9 the description could not test: Apple M2 Max, macOS 27.2,
/usr/bin/python33.9.6 from Xcode. Head 5d632ec79 onmain5d9dcc42d, relinker-only build (-DANYPS5_RELINKER_ONLY=ON).python3 tools/tests/test_pr_overlap.pywith 3.9.6: onmain, 3 errors (TypeError: write_text() got an unexpected keyword argument 'newline', all inCommentStateTests); with this PR, 21/21 OK.-DPython3_EXECUTABLE=/usr/bin/python3:main170/173 (pr_overlap_tools,release_package,linux_fixed_base);pr_overlap_toolspasses with this PR. With this PR and #6728 together: 172/173.mainand with this PR.The one left on 3.9 is
linux_fixed_base:core/relinker/relinker/tests/test_linux_fixed_base.py:107useszip(..., strict=True)(3.10+),TypeError: zip() takes no keyword arguments. Neither this PR nor #6728 touches it.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T14:07:15Z.
Thanks for checking this with Xcode’s Python 3.9 and for identifying the remaining linux_fixed_base failure. I opened #6843 for that separate Python compatibility issue. The focused test passes on Linux/Python 3.11 here; Python 3.9 was unavailable locally, so that runtime confirmation is still outstanding.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T15:19:26Z.
Review: COMMENTED
Thanks for running the Python 3.9 validation. It confirms the fix in this PR removes the three
newline=failures on that runtime. Yourzip(strict=True)finding was separate; I opened #6843 for that remaining compatibility issue and its focused Linux test plus the hosted macOS/Windows/Linux relinker matrix pass.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T17:52:02Z.
Rebased the PR onto current
main(66702f1c) as916eed7ee. The only conflict was in the fixture write; I preserved main’s current test flow and retained the Python 3.9-compatiblewrite_bytespath. Validation:python3 tools/tests/test_pr_overlap.pypasses 21/21,check_conventions.py --base upstream/mainpasses, andgit diff --checkpasses. The Python 3.9/Xcode run reported earlier remains the platform-specific validation; hosted checks are now running for this head.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-18T00:23:04Z.
Thanks for this. Main already fixed the Python 3.9 issue in
02c7da7677, so what's left here no longer changes behaviour. Closing as superseded.Pull request closed