mypy
TypeVisitor and Co now support allow_interpreted_subclasses=True
#9602
Merged

TypeVisitor and Co now support allow_interpreted_subclasses=True #9602

msullivan merged 1 commit into python:master from patch-1
sobolevn
sobolevn4 years ago

Description

Now these types can be extended from plugin code.
Previously it was impossible:

from mypy.type_visitor import TypeVisitor


class KindTranslator(TypeVisitor):
    ...

Was giving:

TypeError: interpreted classes cannot inherit from compiled traits

But, this is a very powerful tool. Some complex type manipulations do require this (or similar) tool.
For example:

More context: #9001 (comment)

Test Plan

I actually don't have any test plan at the moment. I would be very happy to receive any advice! 👍

sobolevn TypeVisitor and Co now support allow_interpreted_subclasses=True
45451f2c
msullivan
msullivan approved these changes on 2020-10-18
msullivan4 years ago

Yeah, this is a good idea. It'll increase our generated code size but shouldn't slow things down.

msullivan msullivan merged a9fa9ab4 into master 4 years ago

Login to write a write a comment.

Login via GitHub

Reviewers
Assignees
No one assigned
Labels
Milestone