remove unused optr code - #10062
Merged
Merged
Conversation
Item.to_optr/from_optr and the whole _item.c (which contained nothing but _object_to_optr/_optr_to_object) were only used by their own test. The mechanism - packing a raw PyObject pointer into a bytes object to pass an object through byte-oriented messaging without serializing it - was meant for a zeromq-based pipeline that never came to be. Nothing in borg calls it, and it is unsafe by nature (the docstring itself warned that the object must not be deallocated between to_optr and from_optr). Rather than porting it to PyCapsule (as borgbackup#5762 suggested), remove it: if a message-passing design ever returns, PyCapsule would be the right tool to build fresh for it.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10062 +/- ##
==========================================
+ Coverage 86.64% 86.76% +0.11%
==========================================
Files 98 98
Lines 17037 17085 +48
Branches 2581 2586 +5
==========================================
+ Hits 14762 14823 +61
+ Misses 1583 1570 -13
Partials 692 692 ☔ View full report in Codecov by Harness. |
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.
Fixes #5762.
Item.to_optr/Item.from_optrand the whole_item.c(41 lines containing nothing but_object_to_optr/_optr_to_object) had exactly one caller: their own test. The mechanism — packing a raw PyObject pointer into bytes to pass an object through byte-oriented messaging without serializing it — was meant for a zeromq-based threading design that never came to borg2, and it is unsafe by nature (its own docstring warned that the object must not be deallocated between the two calls).#5762 suggested porting it to PyCapsule; since nothing uses it, removing it seems better than modernizing it. If a message-passing design ever returns, PyCapsule would be the right tool to build fresh for it. Net: −73 lines, one C file gone.
Full test suite passes (2244 passed — exactly the removed optr test fewer than before); the
item.pyistub was updated accordingly.🤖 Generated with Claude Code