Skip to content
Merged
Show file tree
Hide file tree
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: 2 additions & 2 deletions Lib/logging/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def configure_custom(self, config):
c = self.resolve(c)
props = config.pop('.', None)
# Check for valid identifiers
kwargs = dict((k, config[k]) for k in config if valid_ident(k))
kwargs = {k: config[k] for k in config if valid_ident(k)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is an improvement. Go ahead.

result = c(**kwargs)
if props:
for name, value in props.items():
Expand Down Expand Up @@ -723,7 +723,7 @@ def configure_handler(self, config):
config['address'] = self.as_tuple(config['address'])
factory = klass
props = config.pop('.', None)
kwargs = dict((k, config[k]) for k in config if valid_ident(k))
kwargs = {k: config[k] for k in config if valid_ident(k)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is an improvement. Go ahead.

try:
result = factory(**kwargs)
except TypeError as te:
Expand Down
2 changes: 1 addition & 1 deletion Lib/pstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ def add_callers(target, source):
if func in new_callers:
if isinstance(caller, tuple):
# format used by cProfile
new_callers[func] = tuple(i[0] + i[1] for i in zip(caller, new_callers[func]))
new_callers[func] = tuple(i + j for i, j in zip(caller, new_callers[func]))
else:
# format used by profile
new_callers[func] += caller
Expand Down
2 changes: 1 addition & 1 deletion Lib/turtle.py
Original file line number Diff line number Diff line change
Expand Up @@ -3839,7 +3839,7 @@ def write_docstringdict(filename="turtle_docstringdict"):
docsdict[key] = eval(key).__doc__

with open("%s.py" % filename,"w") as f:
keys = sorted(x for x in docsdict.keys()
keys = sorted(x for x in docsdict

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is an improvement. Go ahead.

if x.split('.')[1] not in _alias_list)
f.write('docsdict = {\n\n')
for key in keys[:-1]:
Expand Down
3 changes: 2 additions & 1 deletion Lib/urllib/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,8 @@ def do_open(self, http_class, req, **http_conn_args):
h.set_debuglevel(self._debuglevel)

headers = dict(req.unredirected_hdrs)
headers.update((k, v) for k, v in req.headers.items() if k not in headers)
headers.update({k: v for k, v in req.headers.items()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please leave as-is. Don't create an unnecessary intermediate dictionary.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I afraid that this change changed semantic.

if k not in headers})

# TODO(jhylton): Should this be redesigned to handle
# persistent connections?
Expand Down