summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-02-26 14:50:11 (GMT)
committerGitHub <noreply@github.com>2018-02-26 14:50:11 (GMT)
commit3f2e6f15d64d81633b1fc0b308afc0d6e9026b61 (patch)
tree47fc15490c06e8d49f0750e8aa75352ef17cfc7c
parent6f600ff1734ca2fdcdd37a809adf8130f0d8cc4e (diff)
downloadcpython-3f2e6f15d64d81633b1fc0b308afc0d6e9026b61.zip
cpython-3f2e6f15d64d81633b1fc0b308afc0d6e9026b61.tar.gz
cpython-3f2e6f15d64d81633b1fc0b308afc0d6e9026b61.tar.bz2
Revert unneccessary changes made in bpo-30296 and apply other improvements. (GH-2624)
-rw-r--r--Lib/logging/config.py4
-rw-r--r--Lib/pstats.py2
-rw-r--r--Lib/turtle.py2
-rw-r--r--Lib/urllib/request.py3
4 files changed, 6 insertions, 5 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index 7927e76..1b0faca 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -460,7 +460,7 @@ class BaseConfigurator(object):
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)}
result = c(**kwargs)
if props:
for name, value in props.items():
@@ -723,7 +723,7 @@ class DictConfigurator(BaseConfigurator):
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)}
try:
result = factory(**kwargs)
except TypeError as te:
diff --git a/Lib/pstats.py b/Lib/pstats.py
index 1b57d26..ded5ae5 100644
--- a/Lib/pstats.py
+++ b/Lib/pstats.py
@@ -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
diff --git a/Lib/turtle.py b/Lib/turtle.py
index 8909fe9..9db564b 100644
--- a/Lib/turtle.py
+++ b/Lib/turtle.py
@@ -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
if x.split('.')[1] not in _alias_list)
f.write('docsdict = {\n\n')
for key in keys[:-1]:
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 2b76942..5b962f7 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -1286,7 +1286,8 @@ class AbstractHTTPHandler(BaseHandler):
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()
+ if k not in headers})
# TODO(jhylton): Should this be redesigned to handle
# persistent connections?