Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signature has wrong class name when using metaclasses #542

Open
gpotter2 opened this issue Jul 9, 2023 · 0 comments
Open

Signature has wrong class name when using metaclasses #542

gpotter2 opened this issue Jul 9, 2023 · 0 comments

Comments

@gpotter2
Copy link
Contributor

gpotter2 commented Jul 9, 2023

When using metaclasses, the signature has the wrong class name. Here's a very easy example:

class Dummy_metaclass(type):
    def __new__(cls, name, bases, dct):
        dct["ID"] = 0 
        return type.__new__(cls, name, bases, dct)

class Test(metaclass=Dummy_metaclass):
    def __init__(self, a, b, c):
        pass

With "Show signature" enabled, this displays:
image

which is dumb. It should be Test(a, b, c). Typically this happens when one use cls.__class__.name instead of cls.__name__.

If I understand this issue correctly, this looks rather like a jedi bug where the wrong value is passed here:

name=signature.name,

which is why I also opened an issue on davidhalter/jedi#1950

Infos: ptpython 3.0.23 on Debian 12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant