mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-28 22:56:55 +08:00
switch order of ContextManager and Generic (#1382)
Since ContextManager inherits from Generic, too, listing Generic first, in the list of base classes, results in a cyclic MRO.
This commit is contained in:
committed by
Guido van Rossum
parent
4656153478
commit
a02f9b6d46
@@ -20,7 +20,7 @@ _ExitFunc = Callable[[Optional[Type[BaseException]],
|
||||
_CM_EF = TypeVar('_CM_EF', ContextManager, _ExitFunc)
|
||||
|
||||
if sys.version_info >= (3, 2):
|
||||
class GeneratorContextManager(Generic[_T], ContextManager[_T]):
|
||||
class GeneratorContextManager(ContextManager[_T], Generic[_T]):
|
||||
def __call__(self, func: Callable[..., _T]) -> Callable[..., _T]: ...
|
||||
def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., GeneratorContextManager[_T]]: ...
|
||||
else:
|
||||
@@ -29,7 +29,7 @@ else:
|
||||
if sys.version_info < (3,):
|
||||
def nested(*mgr: ContextManager[Any]) -> ContextManager[Iterable[Any]]: ...
|
||||
|
||||
class closing(Generic[_T], ContextManager[_T]):
|
||||
class closing(ContextManager[_T], Generic[_T]):
|
||||
def __init__(self, thing: _T) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 4):
|
||||
|
||||
Reference in New Issue
Block a user