File tree 2 files changed +13
-0
lines changed
2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -122,6 +122,14 @@ if sys.version_info >= (3, 9):
122
122
# Predefined type variables.
123
123
AnyStr = TypeVar ("AnyStr" , str , bytes )
124
124
125
+ if sys .version_info >= (3 , 8 ):
126
+ # This class did actually exist in 3.7, but had a different base.
127
+ # We'll just pretend it didn't exist though: the main external use case for _ProtocolMeta is
128
+ # to inherit from for your own custom protocol metaclasses. If you're using 3.7, at runtime
129
+ # you'd use typing_extensions.Protocol, which would be unrelated to typing._ProtocolMeta and
130
+ # so you'd run into metaclass conflicts at runtime if you used typing._ProtocolMeta.
131
+ class _ProtocolMeta (ABCMeta ): ...
132
+
125
133
# Abstract base classes.
126
134
127
135
def runtime_checkable (cls : _TC ) -> _TC : ...
Original file line number Diff line number Diff line change @@ -53,6 +53,11 @@ Literal: _SpecialForm = ...
53
53
54
54
def IntVar (name : str ) -> Any : ... # returns a new TypeVar
55
55
56
+ if sys .version_info < (3 , 8 ):
57
+ # Technically in 3.6 this inherited from GenericMeta. But let's not reflect that, since
58
+ # type checkers tend to assume that Protocols all have the ABCMeta metaclass.
59
+ class _ProtocolMeta (abc .ABCMeta ): ...
60
+
56
61
# Internal mypy fallback type for all typed dicts (does not exist at runtime)
57
62
class _TypedDict (Mapping [str , object ], metaclass = abc .ABCMeta ):
58
63
__required_keys__ : frozenset [str ]
You can’t perform that action at this time.
0 commit comments