You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/Users/leogermond/Lab/python/signature/main.py
/Users/leogermond/Lab/python/signature/main.py:9:7 - error: Cannot assign to attribute "__signature__" for class "function"
Attribute "__signature__" is unknown (reportFunctionMemberAccess)
1 error, 0 warnings, 0 informations
Expected
I would the __signature__ attribute to be specified in the function class (with a special marker indicating it's optional?) of the builtins module. A type checker such as pyright could then infer that setting this attribute is possible and accept the piece of code given in example.
The text was updated successfully, but these errors were encountered:
PEP-362 specifies that in order to cache the signature of any function, it is possible for the user to set its
__signature__
attribute.Actual
This attribute is not set in the
builtins
module over at https://github.com/python/typeshed/blob/main/stdlib/builtins.pyi#L1009As a result a typechecker might reject the following piece of code
e.g. with pyright I have a false positive
Expected
I would the
__signature__
attribute to be specified in thefunction
class (with a special marker indicating it's optional?) of the builtins module. A type checker such as pyright could then infer that setting this attribute is possible and accept the piece of code given in example.The text was updated successfully, but these errors were encountered: