Skip to content

Strip complete leading path separators instead of individual characters - #216

Open
Mrun25 wants to merge 1 commit into
dpath-maintainers:masterfrom
Mrun25:bugfix/215_separator_prefix
Open

Mrun25 wants to merge 1 commit into
dpath-maintainers:masterfrom
Mrun25:bugfix/215_separator_prefix

Conversation

@Mrun25

@Mrun25 Mrun25 commented Nov 7, 2026

Copy link
Copy Markdown

_split_path() currently passes the separator to str.lstrip(), which removes individual separator characters. With separator ab, appleabkey becomes pple/key. If both keys exist, get() silently returns the wrong value; new() can create the wrong key.

Strip only complete leading separator tokens before splitting the path. Repeated whole separators still work. Single-character separators, list paths, None and empty-separator behavior are preserved.

The regression tests cover partial prefixes, repeated leading separators, get(), new(), set(), delete() and search(). Five tests fail against unchanged master and pass with the fix; a separate control checks existing separator behavior.

Validation:

  • Canonical tox environments pass on CPython 3.8-3.14 and PyPy 3.7: 85 tests each.
  • Repository flake8 check passes.
  • Source and wheel builds pass; Twine metadata checks pass with the existing missing content-type warning.
  • Tests ran on Linux. Remote CI has not been verified.

AI assistance was used to prepare and locally test this change. The reproduction uses synthetic inputs, not a claimed production incident.

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