Commit 3511ed4e authored by Stefan Behnel's avatar Stefan Behnel

fix an edge case where resetting async/await keywords occurred too late

parent 918654ad
...@@ -317,7 +317,7 @@ class PyrexScanner(Scanner): ...@@ -317,7 +317,7 @@ class PyrexScanner(Scanner):
self.indentation_stack = [0] self.indentation_stack = [0]
self.indentation_char = None self.indentation_char = None
self.bracket_nesting_level = 0 self.bracket_nesting_level = 0
self.async_enabled = False self.async_enabled = 0
self.begin('INDENT') self.begin('INDENT')
self.sy = '' self.sy = ''
self.next() self.next()
...@@ -506,3 +506,5 @@ class PyrexScanner(Scanner): ...@@ -506,3 +506,5 @@ class PyrexScanner(Scanner):
if not self.async_enabled: if not self.async_enabled:
self.keywords.discard('await') self.keywords.discard('await')
self.keywords.discard('async') self.keywords.discard('async')
if self.sy in ('async', 'await'):
self.sy, self.systring = IDENT, self.context.intern_ustring(self.sy)
...@@ -368,6 +368,7 @@ class AsyncBadSyntaxTest(unittest.TestCase): ...@@ -368,6 +368,7 @@ class AsyncBadSyntaxTest(unittest.TestCase):
async def f(z): async def f(z):
async def g(): pass async def g(): pass
await z await z
await = 1
#self.assertTrue(inspect.iscoroutinefunction(f)) #self.assertTrue(inspect.iscoroutinefunction(f))
......
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