target = p_for_target(s)
if s.sy == 'in':
s.next()
- iterator = p_for_iterator(s)
+ iterator = p_for_iterator(s, allow_testlist)
return { 'target': target, 'iterator': iterator }
- else:
+ elif not s.in_python_file:
if s.sy == 'from':
s.next()
bound1 = p_bit_expr(s)
return node
else:
if ctx.api:
- error(s.pos, "'api' not allowed with this statement")
+ s.error("'api' not allowed with this statement")
elif s.sy == 'def':
- if ctx.level not in ('module', 'class', 'c_class', 'c_class_pxd', 'property'):
+ # 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)