Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f3ad042

Browse files
committed
Issue #25609: Backport typing.ContextManager.
This has no semantic impact as the class is guarded with a hasattr() check; this is being done to keep typing.py in sync between Python 3.5 and 3.6 as requested by Guido.
1 parent 3c149a6 commit f3ad042

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

Lib/typing.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import abc
22
from abc import abstractmethod, abstractproperty
33
import collections
4+
import contextlib
45
import functools
56
import re as stdlib_re # Avoid confusion with the re we export.
67
import sys
@@ -1530,6 +1531,12 @@ class ValuesView(MappingView[VT_co], extra=collections_abc.ValuesView):
15301531
pass
15311532

15321533

1534+
if hasattr(contextlib, 'AbstractContextManager'):
1535+
class ContextManager(Generic[T_co], extra=contextlib.AbstractContextManager):
1536+
__slots__ = ()
1537+
__all__.append('ContextManager')
1538+
1539+
15331540
class Dict(dict, MutableMapping[KT, VT]):
15341541

15351542
def __new__(cls, *args, **kwds):

0 commit comments

Comments
 (0)