Commit fb09adfb authored by Stefan Behnel's avatar Stefan Behnel

Merge branch '0.29.x'

parents 553f3130 3b1b45de
...@@ -431,6 +431,9 @@ Bugs fixed ...@@ -431,6 +431,9 @@ Bugs fixed
* Complex buffer item types of structs of arrays could fail to validate. * Complex buffer item types of structs of arrays could fail to validate.
Patch by Leo and smutch. (Github issue #1407) Patch by Leo and smutch. (Github issue #1407)
* Decorators were not allowed on nested `async def` functions.
(Github issue #1462)
* C-tuples could use invalid C struct casting. * C-tuples could use invalid C struct casting.
Patch by MegaIng. (Github issue #3038) Patch by MegaIng. (Github issue #3038)
......
...@@ -2239,7 +2239,7 @@ def p_statement(s, ctx, first_statement = 0): ...@@ -2239,7 +2239,7 @@ def p_statement(s, ctx, first_statement = 0):
s.error('decorator not allowed here') s.error('decorator not allowed here')
s.level = ctx.level s.level = ctx.level
decorators = p_decorators(s) decorators = p_decorators(s)
if not ctx.allow_struct_enum_decorator and s.sy not in ('def', 'cdef', 'cpdef', 'class'): if not ctx.allow_struct_enum_decorator and s.sy not in ('def', 'cdef', 'cpdef', 'class', 'async'):
if s.sy == 'IDENT' and s.systring == 'async': if s.sy == 'IDENT' and s.systring == 'async':
pass # handled below pass # handled below
else: else:
......
...@@ -33,3 +33,30 @@ async def test_async_temp_gh3337(x, y): ...@@ -33,3 +33,30 @@ async def test_async_temp_gh3337(x, y):
([], 0) ([], 0)
""" """
return min(x - y, 0) return min(x - y, 0)
async def outer_with_nested(called):
"""
>>> called = []
>>> _, inner = run_async(outer_with_nested(called))
>>> called # after outer_with_nested()
['outer', 'make inner', 'deco', 'return inner']
>>> _ = run_async(inner())
>>> called # after inner()
['outer', 'make inner', 'deco', 'return inner', 'inner']
"""
called.append('outer')
def deco(f):
called.append('deco')
return f
called.append('make inner')
@deco
async def inner():
called.append('inner')
return 1
called.append('return inner')
return inner
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