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

any reason why ExtendedTraverserVisitor does not set allow_interpreted_subclasses=True? #14736

Open
akcheung opened this issue Feb 19, 2023 · 1 comment
Labels
feature topic-plugins The plugin API and ideas for new plugins

Comments

@akcheung
Copy link

Feature

I got a TypeError: interpreted classes cannot inherit from compiled when I tried to extend from it. Not sure if this is a bug or not.

To reproduce:

from mypy.parse import parse
from mypy.traverser import ExtendedTraverserVisitor

class FooVisitor(ExtendedTraverserVisitor):
    def visit(self, o: Node) -> bool:
        print("hello")
        return True

parse("print('foo')", None, None, None, Options()).accept(FooVisitor())
@flying-sheep
Copy link

flying-sheep commented Nov 21, 2023

Oh no, that makes my proposed plugin also pretty much impossible. (I want to subclass stubgen.ASTStubGenerator)

Is there any workaround that doesn’t involve copying hundreds of lines of code like the workaround in dosisod/refurb#309?

@AlexWaygood AlexWaygood added the topic-plugins The plugin API and ideas for new plugins label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature topic-plugins The plugin API and ideas for new plugins
Projects
None yet
Development

No branches or pull requests

3 participants