-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
Bug Report
Consider the following input:
from typing import Protocol
class Interface(Protocol):
def dummy(self, arg: str) -> str:
...
stubgen
produces:
class Interface:
def dummy(self, arg: str) -> str: ...
Note that the Protocol
class is removed from the list of base classes.
Obviously this causes problems when performing type checking against users of that generated typestub:
from interface import Interface
class InterfaceImpl:
def dummy(self, arg: str) -> str:
return arg
interf: Interface = InterfaceImpl()
mypy:
provider/__init__.py:8: error: Incompatible types in assignment (expression has type "InterfaceImpl", variable has type "Interface")
Expected Behavior
Protocol
base class is not removed.
Actual Behavior
Protocol
base class is removed.
Your Environment
- Mypy version used: mypy 0.931
- Python version used: Python 3.9.7
- Operating system and version: macOS