Repository navigation
fix(commands): omit COUNT when count=None in the *MPOP commands - #4367
Merged
Merged
Conversation
LMPOP, BLMPOP, ZMPOP and BZMPOP annotate count as `int | None`, but passing None appended `COUNT None` to the command, which the encoder rejects with DataError before anything reaches the server. LPOP, RPOP and SPOP already treat count=None as "omit COUNT"; the four *MPOP commands now do the same, and the server applies its default of 1.
petyaslavova
approved these changes
Oct 2, 2026
petyaslavova
left a comment
Collaborator
There was a problem hiding this comment.
Hey @Rodrigo-Palma, thank you for your contribution! The change looks good, once we have a green CI, I will merge it.
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.
Description of change
lmpop,blmpop,zmpopandbzmpopannotatecountasint | None, butcount=NoneappendedCOUNT Noneto the command:The encoder rejects it before anything reaches the server.
lpop,rpopandspopalready treatcount=Noneas "omit COUNT"; the four *MPOP commands now do the same, so the server applies its default of 1. Explicit counts go out as before.The mixins are shared by the sync and async clients, so the one change covers both.
Test:
test_mpop_commands_omit_count_when_nonepatchesexecute_commandand checks the built args (no server needed). It fails on master for all four commands and passes with the fix; the existing*mpoptests still pass.Pull Request check-list
Note
Low Risk
Narrow command-encoding fix with parametrized tests; explicit count values behave as before.
Overview
Fixes a bug where passing
count=Nonetolmpop,blmpop,zmpop, andbzmpopstill appendedCOUNTwith aNonevalue to the Redis command, which the client encoder rejects before the request is sent.blmpopandbzmpopnow only addCOUNTwhencountis notNone.lmpopandzmpopkeep omittingCOUNTfor the default of 1, and also skip it whencountisNone, matching behavior already used by commands likelpop/rpop.Adds
test_mpop_commands_omit_count_when_none, which asserts the four commands build the expected argument tuples withoutCOUNTwhencount=None.Reviewed by Cursor Bugbot for commit bdf3fc1. Bugbot is set up for automated code reviews on this repo. Configure here.