mirror of
https://github.com/python/cpython.git
synced 2025-10-02 13:22:19 +00:00
Revert unneccessary changes made in bpo-30296 and apply other improvements. (GH-2624)
(cherry picked from commit 3f2e6f15d6
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
a9e0b070b3
commit
f8a3485dcd
4 changed files with 6 additions and 5 deletions
|
@ -460,7 +460,7 @@ class BaseConfigurator(object):
|
||||||
c = self.resolve(c)
|
c = self.resolve(c)
|
||||||
props = config.pop('.', None)
|
props = config.pop('.', None)
|
||||||
# Check for valid identifiers
|
# 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)
|
result = c(**kwargs)
|
||||||
if props:
|
if props:
|
||||||
for name, value in props.items():
|
for name, value in props.items():
|
||||||
|
@ -723,7 +723,7 @@ class DictConfigurator(BaseConfigurator):
|
||||||
config['address'] = self.as_tuple(config['address'])
|
config['address'] = self.as_tuple(config['address'])
|
||||||
factory = klass
|
factory = klass
|
||||||
props = config.pop('.', None)
|
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:
|
try:
|
||||||
result = factory(**kwargs)
|
result = factory(**kwargs)
|
||||||
except TypeError as te:
|
except TypeError as te:
|
||||||
|
|
|
@ -530,7 +530,7 @@ def add_callers(target, source):
|
||||||
if func in new_callers:
|
if func in new_callers:
|
||||||
if isinstance(caller, tuple):
|
if isinstance(caller, tuple):
|
||||||
# format used by cProfile
|
# 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:
|
else:
|
||||||
# format used by profile
|
# format used by profile
|
||||||
new_callers[func] += caller
|
new_callers[func] += caller
|
||||||
|
|
|
@ -3839,7 +3839,7 @@ def write_docstringdict(filename="turtle_docstringdict"):
|
||||||
docsdict[key] = eval(key).__doc__
|
docsdict[key] = eval(key).__doc__
|
||||||
|
|
||||||
with open("%s.py" % filename,"w") as f:
|
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)
|
if x.split('.')[1] not in _alias_list)
|
||||||
f.write('docsdict = {\n\n')
|
f.write('docsdict = {\n\n')
|
||||||
for key in keys[:-1]:
|
for key in keys[:-1]:
|
||||||
|
|
|
@ -1286,7 +1286,8 @@ class AbstractHTTPHandler(BaseHandler):
|
||||||
h.set_debuglevel(self._debuglevel)
|
h.set_debuglevel(self._debuglevel)
|
||||||
|
|
||||||
headers = dict(req.unredirected_hdrs)
|
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
|
# TODO(jhylton): Should this be redesigned to handle
|
||||||
# persistent connections?
|
# persistent connections?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue