Fix remaining Python 3.7 issues to get the tests to pass

This commit is contained in:
Dave Halter
2018-12-06 00:35:09 +01:00
parent 3260867918
commit d9e711ab11
2 changed files with 7 additions and 6 deletions

View File

@@ -327,7 +327,8 @@ class FunctionExecutionContext(TreeContext):
# The contravariant doesn't seem to be defined.
generics = (yield_contexts.py__class__(), NO_CONTEXTS)
return ContextSet(
AnnotatedSubClass(c.stub_context, generics) for c in async_generator_classes
# In Python 3.6 AsyncGenerator is still a class.
AnnotatedSubClass(getattr(c, 'stub_context', c), generics) for c in async_generator_classes
).execute_annotation()
else:
if evaluator.environment.version_info < (3, 5):
@@ -337,7 +338,7 @@ class FunctionExecutionContext(TreeContext):
# Only the first generic is relevant.
generics = (return_contexts.py__class__(), NO_CONTEXTS, NO_CONTEXTS)
return ContextSet(
AnnotatedSubClass(c.stub_context, generics) for c in async_classes
AnnotatedSubClass(getattr(c, 'stub_context', c), generics) for c in async_classes
).execute_annotation()
else:
if is_generator:

View File

@@ -18,13 +18,13 @@ b; continue
b; continu
#? []
c + brea
c + pass
#? []
a + break
a + pass
#? ['break']
b; break
#? ['pass']
b; pass
# -----------------
# Keywords should not appear everywhere.