Issue #19611: handle implicit parameters in inspect.signature

inspect.signature now reports the implicit ``.0`` parameters generated by
the compiler for comprehension and generator expression scopes as if they
were positional-only parameters called ``implicit0``.

Patch by Jelle Zijlstra.
This commit is contained in:
Nick Coghlan 2016-06-04 14:40:03 -07:00
parent d62548afed
commit b4b966ece2
5 changed files with 56 additions and 0 deletions

View file

@ -625,6 +625,16 @@ function.
The name of the parameter as a string. The name must be a valid
Python identifier.
.. impl-detail::
CPython generates implicit parameter names of the form ``.0`` on the
code objects used to implement comprehensions and generator
expressions.
.. versionchanged:: 3.6
These parameter names are exposed by this module as names like
``implicit0``.
.. attribute:: Parameter.default
The default value for the parameter. If the parameter has no default