Preserve explicit None for client metadata config#4081
Merged
Conversation
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
elena-kolevska
approved these changes
May 27, 2026
petyaslavova
added a commit
that referenced
this pull request
May 27, 2026
* Preserve explicit None for client metadata config * Fixing linters after conflict resolution via web interface
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.
Commit d411a47 introduced
DriverInfofor CLIENT SETINFO metadata, but it also made omitted metadata values indistinguishable from values explicitly set toNone. That meant users could no longer passNoneto disable client metadata setup, becauseNonewas resolved into the default redis-py name/version before connection setup.This change introduces a shared
SENTINELmarker for omitted arguments and uses it fordriver_info,lib_name, andlib_versionacross sync, async, and cluster client paths. Omitted values still resolve to the previous defaults (redis-pyand the installed redis-py version), while explicitNoneis preserved. Whendriver_info=None, or both legacy metadata values are explicitlyNone, the resolved config remainsNonesoCLIENT SETINFOis skipped.The shared sentinel lives in
redis.utils, andredis._parsers.socket.SENTINELnow re-exports the same object to preserve compatibility with existing internal/library imports from the older path. Sync cluster kwargs were also updated to allowdriver_infothrough the existing cleanup path.Tests were added for default resolution, explicit
Nonebehavior, shared sentinel compatibility, client-level propagation, and sync/async connection handshakes that should skip CLIENT SETINFO when metadata is disabled.Note
Low Risk
Behavior change is limited to client metadata resolution and connection handshake SETINFO; defaults for omitted args stay the same, with tests covering explicit None and skip paths.
Overview
Introduces a shared
SENTINELmarker inredis.utils(re-exported fromredis._parsers.socketfor compatibility) so omitteddriver_info/lib_name/lib_versionarguments are distinct from explicitNone.Sync, async, cluster, and connection constructors now default those parameters to
SENTINELinstead ofNone.resolve_driver_infoandDriverInfoonly apply the usualredis-pydefaults when values are omitted; explicitNoneis preserved soCLIENT SETINFOis skipped on connect. Cluster client kwargs were updated to passdriver_infothrough the existing cleanup path.Tests cover default resolution, explicit-
Nonepropagation, sentinel identity, and sync/async handshakes that must not send SETINFO when metadata is disabled.Reviewed by Cursor Bugbot for commit c2a6010. Bugbot is set up for automated code reviews on this repo. Configure here.