From d9e711ab1191e47f19bf98a54f71d1d2dfe19db2 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Thu, 6 Dec 2018 00:35:09 +0100 Subject: [PATCH] Fix remaining Python 3.7 issues to get the tests to pass --- jedi/evaluate/context/function.py | 5 +++-- test/completion/keywords.py | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/jedi/evaluate/context/function.py b/jedi/evaluate/context/function.py index e0d92815..31f61e51 100644 --- a/jedi/evaluate/context/function.py +++ b/jedi/evaluate/context/function.py @@ -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: diff --git a/test/completion/keywords.py b/test/completion/keywords.py index 9631e8d6..fa9bf52d 100644 --- a/test/completion/keywords.py +++ b/test/completion/keywords.py @@ -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.