Skip to content

Distinguish omitted and None defaults in FSMap.pop - #2136

Open
betacatsling wants to merge 1 commit into
fsspec:masterfrom
betacatsling:fix/fsmap-pop-none
Open

Distinguish omitted and None defaults in FSMap.pop#2136
betacatsling wants to merge 1 commit into
fsspec:masterfrom
betacatsling:fix/fsmap-pop-none

Conversation

@betacatsling

Copy link
Copy Markdown

FSMap.pop(key, None) currently raises for missing keys because the implementation conflates an explicit None default with an omitted default. Use a sentinel and handle lookup failure in pop, matching MutableMapping semantics.

Tests exercise memory and local mappings, explicit None and other falsy defaults, missing keys without a default, and retrieval/removal of existing values. The two None cases fail on the unchanged base. With the fix, mapping and adjacent local/memory/DirFS suites give 379 passed, 16 skipped. Ruff lint/format and git diff --check passed.

AI assistance was used for implementation and local verification.

Fixes #2135.

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.

FSMap.pop raises instead of returning an explicit None default

1 participant