bpo-32018: Fix inspect.signature repr to follow PEP 8 (#4408)

This commit is contained in:
Dong-hee Na 2017-11-16 03:30:59 +09:00 committed by Yury Selivanov
parent f8a4c03ede
commit 762b9571c9
4 changed files with 10 additions and 5 deletions

View File

@ -2525,6 +2525,9 @@ class Parameter:
formatannotation(self._annotation)) formatannotation(self._annotation))
if self._default is not _empty: if self._default is not _empty:
if self._annotation is not _empty:
formatted = '{} = {}'.format(formatted, repr(self._default))
else:
formatted = '{}={}'.format(formatted, repr(self._default)) formatted = '{}={}'.format(formatted, repr(self._default))
if kind == _VAR_POSITIONAL: if kind == _VAR_POSITIONAL:

View File

@ -0,0 +1,2 @@
inspect.signature should follow PEP 8, if the parameter has an annotation and a
default value. Patch by Dong-hee Na.