Skip to content

Remove cleared placeholders when deleting list suffixes - #210

Open
muneikh wants to merge 1 commit into
dpath-maintainers:masterfrom
muneikh:fix-delete-list-suffixes
Open

muneikh wants to merge 1 commit into
dpath-maintainers:masterfrom
muneikh:fix-delete-list-suffixes

Conversation

@muneikh

@muneikh muneikh commented Oct 11, 2026

Copy link
Copy Markdown

Deleting all list elements currently leaves trailing None placeholders: dpath.delete({'items': [0, 1, 2]}, 'items/*') produces {'items': [None, None]}. The same happens when deleting a contiguous suffix or entries in nested lists.

Track the positions cleared by this delete call. When removing a list tail, remove any newly cleared positions that have become trailing positions too. Original None values and indices of retained entries remain intact, and traversal order stays unchanged.

Regression tests cover entire lists, suffixes, nested lists, interior holes, and pre-existing None values. Three original regressions fail before the change. Full nose2/Hypothesis suites pass through tox on Python 3.10 and 3.13.

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.

1 participant