[New-bugs-announce] [issue39566] inspect.Signature.__init__ asks for parameters as dict but treats as list

Nicholas Matthews report at bugs.python.org
Wed Feb 5 18:37:24 EST 2020


New submission from Nicholas Matthews <nmatthews at asapp.com>:

The class inspect.Signature asks for parameters of type dict in python 3.8+ (and OrderedDict in earlier versions); however the __init__ function iterates over parameters as if it were a list, specifically:

for param in parameters:
    name = param.name
    kind = param.kind
    ...

Either the docstring should be changed to specify Sequence / List, or the implementation should be changed to iterate over the values of parameters:

for param in parameters.values():
    ...

(https://github.com/python/cpython/blob/2cca8efe46935c39c445f585bce54954fad2485b/Lib/inspect.py#L2734)

----------
messages: 361461
nosy: Nicholas Matthews
priority: normal
severity: normal
status: open
title: inspect.Signature.__init__ asks for parameters as dict but treats as list
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39566>
_______________________________________


More information about the New-bugs-announce mailing list