pypy support: fix incompatibilities and a severe cpyext memory leak, see #1755 - #9976
Draft
ThomasWaldmann wants to merge 1 commit into
Draft
pypy support: fix incompatibilities and a severe cpyext memory leak, see #1755#9976ThomasWaldmann wants to merge 1 commit into
ThomasWaldmann wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9976 +/- ##
==========================================
- Coverage 85.84% 85.83% -0.02%
==========================================
Files 95 95
Lines 17056 17072 +16
Branches 2614 2616 +2
==========================================
+ Hits 14642 14653 +11
- Misses 1674 1679 +5
Partials 740 740 ☔ View full report in Codecov by Harness. |
This was referenced Jul 30, 2026
ThomasWaldmann
marked this pull request as draft
July 30, 2026 20:19
Member
Author
|
Guess most of these should be fixed in PyPy rather, so do not merge this yet. |
With these changes, borg works on pypy3.11 (7.3.23) on macOS: the full test suite passes (2 pypy-specific expectation tweaks, 1 xfail) and it causes no changes/regressions on CPython. - platformflags: add is_pypy - platform/darwin: pypy's fcntl module does not expose F_FULLFSYNC, fall back to the numeric constant (51). - crypto/low_level: pypy's hmac.digest only accepts bytes keys/data (no memoryview, no bytearray), coerce on pypy. - archive: pypy's os.link advertises follow_symlinks support, but raises EINVAL when the parameter is used (pypy bug). Emulate the secure CVE-2026-62268 behaviour: plain os.link for regular files, an equal symlink when the hardlink target is a symlink (fail closed otherwise). - tests: use sys.executable instead of "python3" in test_with_lock (robustness, not pypy-specific), ignore the pure-python msgpack warning on stderr, expect slow msgpack on pypy, xfail test_unknown_property (cdef class attr setting not blocked on pypy), relax inode identity assertion for the emulated hardlinked-symlink restore, reference darwin.F_FULLFSYNC instead of fcntl's. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
With this PR (plus #9978), borg works on pypy3.11 (tested: 7.3.23 on macOS/arm64): the full test suite passes under pypy (2056 passed, 1 xfailed) and there are no regressions on CPython (full suite verified). Details and benchmark numbers in #1755 (comment).
Changes:
platformflags: addis_pypy.platform/darwin: pypy'sfcntllacksF_FULLFSYNC→ numeric fallback (51).crypto/low_level: pypy'shmac.digestonly acceptsbytes→ coerce memoryview/bytearray on pypy.archive: pypy'sos.link(follow_symlinks=False)raises EINVAL despite advertised support (pypy bug) → emulate the secure CVE-2026-62268 behaviour (plain link for regular targets, an equal symlink when the hardlink target is a symlink).sys.executableinstead of hardcodedpython3intest_with_lock(robustness fix, helps any venv layout), tolerate the pure-python-msgpack warning, xfailtest_unknown_propertyon pypy, relax the inode identity assertion for the emulated hardlinked-symlink restore.The severe pypy memory leak found during this work (chunk data memoryviews never released) is split out into #9978, since that fix is useful independently of pypy.
Follow-up to the (closed) #1755.
🤖 Generated with Claude Code