any reason why ExtendedTraverserVisitor does not set allow_interpreted_subclasses=True?
Open
Nobody has claimed this yet.
feature
topic-plugins
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
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())
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading mypy/traverser.py, especially ExtendedTraverserVisitor, and mypy/parse.py to understand how the parsed tree reaches the visitor. Reproduce the TypeError with the example, then determine whether enabling interpreted subclasses is intended and verify the chosen behavior with a focused test or documented rationale.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100