Repository navigation
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
petyaslavova
left a comment
There was a problem hiding this comment.
Hey @taltal-beep, thank you for your contribution!
Thanks for splitting this out of #4464. The change looks good: it uses the same to_bool parsing as the other boolean URL options, it's mirrored in both stacks, and since it goes through parse_url the cluster clients get the fix too.
Because it changes replies from str to bytes for URLs with decode_responses=False today, I'm labeling it as a breaking change and holding it for the next major release. No changes are needed now. Once #4464 is merged, this branch will need a quick rebase for the one-line conflict in redis/connection.py.
from_url() casts query arguments with URL_QUERY_ARGUMENT_PARSERS, but decode_responses was missing from it and reached the connection as a raw string, so ?decode_responses=False (or 0/no) turned decoding on. Parse it with to_bool like the other boolean options, in both the sync and asyncio parser tables. This changes replies from str to bytes for URLs that set decode_responses=False today, so it is meant for the next major release (split out of redis#4464 at the maintainer's request).
8f0a7df to
5bfb945
Compare
|
Rebased on current master ( |
Description of change
Split out of #4464 at the maintainer's request, to hold for the next major release. Part of #4463.
from_url()casts query-string options withURL_QUERY_ARGUMENT_PARSERS, and its docstring says boolean options accept "True"/"False" or "Yes"/"No".decode_responsesis missing from that table (sync and asyncio), so it reaches the connection as a raw string and?decode_responses=False(or0/no) turns decoding on:This adds
decode_responseswithto_boolto both tables, like the other boolean options.Breaking change: anyone whose URL sets
decode_responses=False(or0/no) getsstrreplies today and will getbytesafter this change, which is why it is kept out of #4464.Pull Request check-list
Please make sure to review and check all of these items:
NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.
The new tests are in the existing URL parsing test classes (sync and asyncio) and fail without the change; the URL parsing tests and ruff pass locally. Fork CI not run for this branch yet. No API change, so no documentation update (the
from_urldocstring already describes this behaviour), and no example applies.Note
Medium Risk
Behavior change for anyone relying on URL
decode_responses=false/no/0today; response type (strvsbytes) flips for those clients at upgrade.Overview
decode_responsesinConnectionPool.from_url/Redis.from_urlquery strings is now parsed withto_bool, matching other boolean URL options in sync and asyncio (redis/connection.py,redis/asyncio/connection.py). Values likeFalse,0, andnobecome realFalseinstead of staying as strings (where e.g."False"behaved like enabled decoding).Breaking (next major): URLs that set
decode_responses=False(or similar “off” spellings) currently get decodedstrreplies because the flag was mis-handled; after this change they getbytesas intended.Sync and asyncio connection-pool tests assert
connection_kwargsandget_encoder().decode_responsesfor?decode_responses=Falseand?decode_responses=Yes.Reviewed by Cursor Bugbot for commit 5bfb945. Bugbot is set up for automated code reviews on this repo. Configure here.