Repository navigation
Conversation
Numbers in request lines were formatted with %a, which is repr(), so an IntEnum exptime or an IntFlag from a flag handler was sent as e.g. <TTL.HOUR: 3600> and memcached rejected the command. Use %d.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #532 +/- ##
==========================================
+ Coverage 98.37% 98.41% +0.04%
==========================================
Files 10 10
Lines 1229 1261 +32
Branches 65 65
==========================================
+ Hits 1209 1241 +32
Misses 12 12
Partials 8 8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
[Medium impact] The PR appears safe to merge. Reviews (3) · Last reviewed commit: "Merge master" · Reviewed by Greptile |
%d truncates a float, so incr(key, 2.5) would add 2. Pass the cas token, flags and delta through operator.index(), which keeps IntEnum and IntFlag working and raises ValidationException for anything else.
| _SetFlagHandler = Callable[[_T], Awaitable[tuple[bytes, int]]] | ||
|
|
||
|
|
||
| def _int(value: object, name: str) -> int: |
Member
There was a problem hiding this comment.
Everything we pass to it is typed as int, so this should fix the type error:
Suggested change
| def _int(value: object, name: str) -> int: | |
| def _int(value: int, name: str) -> int: |
| _SetFlagHandler = Callable[[_T], Awaitable[tuple[bytes, int]]] | ||
|
|
||
|
|
||
| def _int(value: object, name: str) -> int: |
Member
There was a problem hiding this comment.
The duplicate name parameter feels a little awkward to me, I'd probably drop it and let the traceback handle it..
Contributor
Author
There was a problem hiding this comment.
@Dreamsorcerer Done, both applied in 1f4c4b2, and merged master to fix the conflict.
# Conflicts: # CHANGES.rst
This branch has not been deployed
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.
Numbers in request lines are formatted with
%a, which isrepr(). For a plainintthat's the same, but anIntEnumorIntFlaggets sent as its repr, so this fails:The same happens for a flag handler that returns an
IntFlag, thetouch()exptime and theincr()/decr()delta. This changes the 4 places to%d, which sends the value.Not in a release yet: 0.8.2 used
str(), which is the number on Python 3.11+.