Commit abe58b24 authored by Stefan Behnel's avatar Stefan Behnel

Add "generator_stop" to default future imports for language_level=3.

See #2580.
parent 4ee7ae77
...@@ -98,16 +98,16 @@ class Context(object): ...@@ -98,16 +98,16 @@ class Context(object):
self.gdb_debug_outputwriter = None self.gdb_debug_outputwriter = None
def set_language_level(self, level): def set_language_level(self, level):
from .Future import print_function, unicode_literals, absolute_import, division from .Future import print_function, unicode_literals, absolute_import, division, generator_stop
future_directives = [] future_directives = []
if level == '3str': if level == '3str':
future_directives = [print_function, absolute_import, division] future_directives = [print_function, absolute_import, division, generator_stop]
self.future_directives.discard(unicode_literals) self.future_directives.discard(unicode_literals)
level = 3 level = 3
else: else:
level = int(level) level = int(level)
if level >= 3: if level >= 3:
future_directives = [print_function, unicode_literals, absolute_import, division] future_directives = [print_function, unicode_literals, absolute_import, division, generator_stop]
self.language_level = level self.language_level = level
if future_directives: if future_directives:
self.future_directives.update(future_directives) self.future_directives.update(future_directives)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment