This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: inspect.Signature.__init__ asks for parameters as dict but treats as list
Type: behavior Stage: resolved
Components: Versions: Python 3.8
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Nicholas Matthews, xtreak
Priority: normal Keywords:

Created on 2020-02-05 23:37 by Nicholas Matthews, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (4)
msg361461 - (view) Author: Nicholas Matthews (Nicholas Matthews) Date: 2020-02-05 23:37
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 =
    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():

msg361479 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2020-02-06 12:37
It says list in the __init__ doc :

It says that parameters is a public property that returns a mapping of parameter name to object at : . The change to dict was done with 2cca8efe46935c39c445f585bce54954fad2485b .

I can see the public attribute returning dictionary. Can you please point to the doc where it says the parameter should be a dictionary to the constructor?
msg361498 - (view) Author: Nicholas Matthews (Nicholas Matthews) Date: 2020-02-06 17:39
I originally filed an issue believing the documentation for inspect.Signature was incorrect; I now think I misread the documentation. (Apologies, I'm used to a different docstring format)
msg361499 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2020-02-06 18:21
No problem, closing it as not a bug. Feel free to reopen if needed.
Date User Action Args
2022-04-11 14:59:26adminsetgithub: 83747
2020-02-06 18:21:56xtreaksetstatus: open -> closed
resolution: not a bug
messages: + msg361499

stage: resolved
2020-02-06 17:39:45Nicholas Matthewssetmessages: + msg361498
2020-02-06 12:37:36xtreaksetnosy: + xtreak
messages: + msg361479
2020-02-05 23:37:23Nicholas Matthewscreate