Repository navigation
fix(backends): count a 0.3.x None from delete() as removed, with a FutureWarning - #428
Merged
Merged
Conversation
…rning The #71 fallbacks treated a None result as "not removed", so a backend written against 0.3.x lost every get_and_delete() and delete_if_equals() race against itself after deleting the key. None now keeps the 0.3.x meaning and emits a DeprecationWarning; 0.5.0 treats it as False.
…s shown by default
4 tasks
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.
Follow-up to #427 (#71).
#427 made
delete()return whether a key was removed, and the non-atomic fallbacks (delete_many,get_and_delete,delete_if_equals) now use that result. A third-party backend written for 0.3.x still returnsNone, which those fallbacks would have read as "not removed":get_and_deletewould returnNoneafter deleting the entry,delete_if_equalswould report failure, anddelete_manywould count 0.This change routes the fallbacks through
_delete_reporting, which countsNoneas removed, as every fallback assumed in 0.3.x, and emits aFutureWarningnaming the backend class and linking the migration guide.FutureWarningrather thanDeprecationWarningbecause the warning is raised inside the package, where aDeprecationWarningis hidden by default, and the behaviour change in 0.5.0 (treatingNoneasFalse) affects the application at runtime.tests/backends/test_base.py: a legacy backend whosedelete()returnsNone, checked against all three fallbacks (result and warning).An independent review agent read the change before this PR; its finding (warning class) is applied in the second commit.
Refs #71