cpython: fe842efbe1ed (original) (raw)

--- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -517,6 +517,9 @@ class GenericTests(BaseTestCase): Y[str, str] def test_generic_errors(self):

@@ -1255,7 +1258,7 @@ ASYNCIO = sys.version_info[:2] >= (3, 5) ASYNCIO_TESTS = """ import asyncio -T_a = TypeVar('T') +T_a = TypeVar('T_a') class AwaitableWrapper(typing.Awaitable[T_a]): @@ -1404,6 +1407,24 @@ class CollectionsAbcTests(BaseTestCase): g.send(None) # Run foo() till completion, to avoid warning. @skipUnless(ASYNCIO, 'Python 3.5 and multithreading required')

+

--- a/Lib/typing.py +++ b/Lib/typing.py @@ -29,9 +29,6 @@ if sys.version_info[:2] >= (3, 3): # ABCs (from collections.abc). 'AbstractSet', # collections.abc.Set.

# Structural checks, a.k.a. protocols. 'Reversible', @@ -1104,6 +1109,9 @@ class Generic(metaclass=GenericMeta): slots = () def new(cls, *args, **kwds):

@@ -1639,8 +1647,16 @@ Hashable = collections_abc.Hashable # N if hasattr(collections_abc, 'Awaitable'): class Awaitable(Generic[T_co], extra=collections_abc.Awaitable): slots = () -else:

+

+ + +if hasattr(collections_abc, 'Coroutine'):

+

if hasattr(collections_abc, 'AsyncIterable'): @@ -1652,9 +1668,8 @@ if hasattr(collections_abc, 'AsyncIterab extra=collections_abc.AsyncIterator): slots = () -else:

class Iterable(Generic[T_co], extra=collections_abc.Iterable):