Skip to content

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

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tools/hook-scripts/mailer/mailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,9 @@ def repos_params(section_name, defaults):
# Extract key/value pairs from the regex match of this
# repository, and merge them into the default params.
# Make sure to copy() to avoid mutation of the argument.
return defaults.copy().update(match.groupdict())
merged_defaults = defaults.copy()
merged_defaults.update(match.groupdict())
return merged_defaults
Copy link
Member

@brainy brainy Jul 8, 2025

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, no Perl code. 😉


# There are no repository-specific key/value params, to add.
return defaults
Expand Down
Loading