Skip to content

Preserve Python radix branches after deleting a parent prefix - #91

Open
omrzk wants to merge 1 commit into
mjschultz:mainfrom
omrzk:fix/preserve-python-deletion-branches-52
Open

omrzk wants to merge 1 commit into
mjschultz:mainfrom
omrzk:fix/preserve-python-deletion-branches-52

Conversation

@omrzk

@omrzk omrzk commented Nov 15, 2026

Copy link
Copy Markdown

Deleting a pure-Python radix node with two children resets its branch bit position to zero. Subsequent searches can no longer reach its right descendant even though the prefix still appears in nodes(), and deleting that descendant raises KeyError.

Turn the deleted prefix into the same glue-node representation used when inserting branches, retaining the original bit position. The regression covers IPv4, a non-byte-aligned prefix, and IPv6 at the root and beneath an ancestor, then checks lookups, retained child data/identity, parent reinsertion and repeated deletion.

Fixes #52. Related to #88, whose loader imports the pure-Python backend; the large external dataset was not run here.

Validation: all six regression cases fail on current main and pass with this patch. Full pytest: Python 3.10 with the native extension 41 pass; Python 3.14 with the native extension 40 pass/one skip; Python 3.12 pure Python 40 pass/one skip. All runs pass the six added subtests. The configured flake8 checks pass. Native extension control builds used local Python 3.10/3.14 headers; the system Python 3.12 headers are unavailable.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Right node inaccessible after deleting parent

1 participant