[issue39566] inspect.Signature.__init__ asks for parameters as dict but treats as list

2020-02-06 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

No problem, closing it as not a bug. Feel free to reopen if needed.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39566] inspect.Signature.__init__ asks for parameters as dict but treats as list

2020-02-06 Thread Nicholas Matthews


Nicholas Matthews  added the comment:

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)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39566] inspect.Signature.__init__ asks for parameters as dict but treats as list

2020-02-06 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

It says list in the __init__ doc : 
https://github.com/python/cpython/blob/54b4f14712b9350f11c983f1c8ac47a3716958a7/Lib/inspect.py#L2759

It says that parameters is a public property that returns a mapping of 
parameter name to object at : 
https://github.com/python/cpython/blob/54b4f14712b9350f11c983f1c8ac47a3716958a7/Lib/inspect.py#L2734
 . 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?

--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39566] inspect.Signature.__init__ asks for parameters as dict but treats as list

2020-02-05 Thread Nicholas Matthews


New submission from Nicholas Matthews :

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com