ITADN

Support for `__new__` constructor signatures

#2073Openjtbandes 创建于 2025-09-16
J
jtbandescommented
`get_signatures` seems to recognize `def __init__(self, ...)` methods, but does not recognize the [`def __new__(cls, ...)`](https://docs.python.org/3/reference/datamodel.html#object.__new__) static method: ```py >>> jedi.Script("class C:\n def __init__(self, a: int):\n pass\nC(").get_signatures(4,2) [<Signature: index=0 C(a: int)>] ``` ```py >>> jedi.Script("class C:\n def __new__(cls, a: int):\n pass\nC(").get_signatures(4,2) [<Signature: index=None C()>] ``` I would expect the `a=` param to be present in this signature. For example, `ipython3` recognizes the constructor call and offers the param for tab-completion: <img width="360" height="179" alt="Image" src="https://github.com/user-attachments/assets/57242e29-7d72-49c2-8936-a80410218e13" />
0 条评论