Commit 4282e6d2 authored by Craig Citro's avatar Craig Citro

Fix parsing for allowing def statements only where legal.

parent 46b3a2aa
...@@ -1658,8 +1658,10 @@ def p_statement(s, ctx, first_statement = 0): ...@@ -1658,8 +1658,10 @@ def p_statement(s, ctx, first_statement = 0):
if ctx.api: if ctx.api:
error(s.pos, "'api' not allowed with this statement") error(s.pos, "'api' not allowed with this statement")
elif s.sy == 'def': elif s.sy == 'def':
#if ctx.level not in ('module', 'class', 'c_class', 'c_class_pxd', 'property', 'function'): # def statements aren't allowed in pxd files, except
# s.error('def statement not allowed here') # as part of a cdef class
if ('pxd' in ctx.level) and (ctx.level != 'c_class_pxd'):
s.error('def statement not allowed here')
s.level = ctx.level s.level = ctx.level
return p_def_statement(s, decorators) return p_def_statement(s, decorators)
elif s.sy == 'class': elif s.sy == 'class':
......
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