Author amaury.forgeotdarc
Recipients Carl.Friedrich.Bolz, amaury.forgeotdarc, arigo, benjamin.peterson, fijal, mark.dickinson
Date 2009-02-02.23:48:23
SpamBayes Score 3.52479e-05
Marked as misclassified No
Message-id <1233618507.04.0.216983591446.issue1875@psf.upfronthosting.co.za>
In-reply-to
Content
Here is a patch that properly raises SyntaxError when 'return' or  
'yield' statements appear outside a function.

I did not bother to update the (deprecated) compiler package: it seems 
to be completely foreign to this kind of checks...

>>> dis.dis(compiler.compile("return 1", "module.py", "exec"))
  1           0 LOAD_CONST               1 (1)
              3 RETURN_VALUE
              4 LOAD_CONST               0 (None)
              7 RETURN_VALUE
History
Date User Action Args
2009-02-02 23:48:27amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, arigo, mark.dickinson, fijal, Carl.Friedrich.Bolz, benjamin.peterson
2009-02-02 23:48:27amaury.forgeotdarcsetmessageid: <1233618507.04.0.216983591446.issue1875@psf.upfronthosting.co.za>
2009-02-02 23:48:25amaury.forgeotdarclinkissue1875 messages
2009-02-02 23:48:24amaury.forgeotdarccreate