-
Notifications
You must be signed in to change notification settings - Fork 542
fix(redisdb): correct kwargs None check in RedisDB.__init__ #307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zhouxinfei
wants to merge
3
commits into
Boris-code:master
Choose a base branch
from
zhouxinfei:fix/redisdb-kwargs-bug
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
💡
if not kwargs会覆盖调用方显式传入的空字典语义(若需要区分“未提供”与“提供但为空”)当前签名使用
**kwargs,调用方无法传入 None,只能传入若干关键字参数;因此kwargs为空通常代表“未提供额外参数”,回退到setting.REDISDB_KWARGS是合理的。但如果未来希望支持RedisDB(**{})这类“显式要求不使用默认 kwargs”的语义(尽管当前也等价于没传),if not kwargs会强制回退到全局默认,无法表达“空覆盖”。这属于产品/接口语义选择问题,不一定要改。建议: 保持当前实现即可;若要区分语义,可改用显式参数(例如
kwargs: dict | None = None)而不是**kwargs,并在内部合并/覆盖。