if ctx.api:
error(s.pos, "'api' not allowed with this statement")
elif s.sy == 'def':
- #if ctx.level not in ('module', 'class', 'c_class', 'c_class_pxd', 'property', 'function'):
- # s.error('def statement not allowed here')
+ # def statements aren't allowed in pxd files, except
+ # 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
return p_def_statement(s, decorators)
elif s.sy == 'class':