-
Notifications
You must be signed in to change notification settings - Fork 186
Bug: dict.copy() always returns None #33
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
Bug: dict.copy() always returns None #33
Conversation
We need the merged defaults copy returned to us, so the old return is instead split into three commands: - copy `defaults` - update the copy with `match.groupdict()` - return the updated copy
Eh? |
the original code returns the result of |
Yes, yes, the title of the PR is just wrong. |
return defaults.copy().update(match.groupdict()) | ||
merged_defaults = defaults.copy() | ||
merged_defaults.update(match.groupdict()) | ||
return merged_defaults |
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.
It you can guarantee this is Python 3.5+ (which it should be, 3.6 is EOL), then:
return {**defaults, **match.groupdict()}
Otherwise, the above works with Python 2, too.
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.
Please, no Perl code. 😉
* tools/hook-scripts/mailer/mailer.py (Config._prep_groups::repos_params): If there's a match for the repository configuration, copy the defaults dict and update it in place before returning the new dict. Patch by: humbedooh git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1927075 13f79535-47bb-0310-9956-ffa450edef68
Committed a slightly tweaked patch in r1927075. |
(Config.repos_params): don't use "defaults" for the merged values. The comments make this confusing. Use "merged" for clarity. [ related to PR #33 ] git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1927078 13f79535-47bb-0310-9956-ffa450edef68
Re-using the "defaults" variable for other purposes made the code confusing, especially with the "fall through" to where the comment mentions nothing to add. I used Daniel's original form, with a new dict named "merged" which is explicitly returned in the if-branch. |
We need the merged defaults copy returned to us, so the old return is instead split into three commands:
defaults
match.groupdict()