[issue1875] "if 0: return" not raising SyntaxError

2019-12-02 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue1875] "if 0: return" not raising SyntaxError

2019-07-05 Thread Ned Deily
Ned Deily added the comment: See also discussion in Issue37500. -- nosy: +ned.deily ___ Python tracker ___ ___ Python-bugs-list

[issue1875] "if 0: return" not raising SyntaxError

2019-06-15 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +13965 stage: -> patch review pull_request: https://github.com/python/cpython/pull/14116 ___ Python tracker ___

[issue1875] "if 0: return" not raising SyntaxError

2019-06-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The issue is not fixed yet. The compiler now rejects if 0: return but it still accepts if 1: pass else: return while 0: return -- resolution: fixed -> stage: resolved -> status: closed -> open

[issue1875] "if 0: return" not raising SyntaxError

2019-05-17 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue1875] "if 0: return" not raising SyntaxError

2019-05-17 Thread miss-islington
miss-islington added the comment: New changeset 85ed1712e428f93408f56fc684816f9a85b0ebc0 by Miss Islington (bot) in branch '3.7': bpo-1875: Raise SyntaxError in invalid blocks that will be optimised away (GH-13332)

[issue1875] "if 0: return" not raising SyntaxError

2019-05-17 Thread miss-islington
Change by miss-islington : -- pull_requests: +13293 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue1875] "if 0: return" not raising SyntaxError

2019-05-17 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: New changeset af8646c8054d0f4180a2013383039b6a472f9698 by Pablo Galindo in branch 'master': bpo-1875: Raise SyntaxError in invalid blocks that will be optimised away (GH-13332)

[issue1875] "if 0: return" not raising SyntaxError

2019-05-15 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: >The drawback of compiling the dead code is adding cells for unneeded constants >and local variables. Also it can create less optimal code for jumps. Is unlikely that this situation arises often enough that this is a concern. We would be sacrificing

[issue1875] "if 0: return" not raising SyntaxError

2019-05-15 Thread Armin Rigo
Change by Armin Rigo : -- nosy: -arigo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue1875] "if 0: return" not raising SyntaxError

2019-05-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The drawback of compiling the dead code is adding cells for unneeded constants and local variables. Also it can create less optimal code for jumps. -- ___ Python tracker

[issue1875] "if 0: return" not raising SyntaxError

2019-05-14 Thread Pablo Galindo Salgado
Change by Pablo Galindo Salgado : -- pull_requests: +13244 stage: needs patch -> patch review ___ Python tracker ___ ___

[issue1875] "if 0: return" not raising SyntaxError

2019-05-14 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: The issue is not fixed. The problem is that this still allows invalid syntax because the code is optimized away: def f(): if 0: break print("Hello") f() -- nosy: +pablogsal ___ Python

[issue1875] "if 0: return" not raising SyntaxError

2019-05-14 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: With the last 2.7 and 3.7, I can import the x module and the 'hello' is automatically printed. Python 2.7.15 (default, Oct 15 2018, 15:26:09) [GCC 8.2.1 20180801 (Red Hat 8.2.1-2)] on linux2 Type "help", "copyright", "credits" or "license" for more

[issue1875] if 0: return not raising SyntaxError

2014-02-03 Thread Mark Lawrence
Changes by Mark Lawrence breamore...@yahoo.co.uk: -- nosy: -BreamoreBoy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1875 ___ ___

[issue1875] if 0: return not raising SyntaxError

2014-02-03 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1875 ___

[issue1875] if 0: return not raising SyntaxError

2013-04-07 Thread Terry J. Reedy
Changes by Terry J. Reedy tjre...@udel.edu: -- versions: +Python 3.3, Python 3.4 -Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1875 ___

[issue1875] if 0: return not raising SyntaxError

2010-09-20 Thread Mark Lawrence
Mark Lawrence breamore...@yahoo.co.uk added the comment: msg81023 indicates that more work is needed on this. -- nosy: +BreamoreBoy stage: - needs patch type: - behavior versions: +Python 2.7, Python 3.1, Python 3.2 -Python 2.6 ___ Python tracker

[issue1875] if 0: return not raising SyntaxError

2009-08-23 Thread Lino Mastrodomenico
Changes by Lino Mastrodomenico l.mastrodomen...@gmail.com: -- nosy: +mastrodomenico ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1875 ___ ___

[issue1875] if 0: return not raising SyntaxError

2009-02-02 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: This was corrected by Benjamin with r69158. Now the yield statement is still optimized away, but at least the CO_GENERATOR flag is set only when compiling a function. -- nosy: +amaury.forgeotdarc, benjamin.peterson resolution:

[issue1875] if 0: return not raising SyntaxError

2009-02-02 Thread Armin Rigo
Armin Rigo ar...@users.sourceforge.net added the comment: ...which does not really solve anything, as if 0: yield at module-level is now just ignored instead of raising a SyntaxError (e.g. like if False: yield). ___ Python tracker rep...@bugs.python.org

[issue1875] if 0: return not raising SyntaxError

2009-02-02 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: 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...

[issue1875] if 0: return not raising SyntaxError

2009-02-02 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: You should remove the error logic compile.c for return and yield in function calls. The problem with this approach is that every SyntaxError generated during bytecode compilation must be moved to earlier. For example, I can still use

[issue1875] if 0: return not raising SyntaxError

2008-01-19 Thread Armin Rigo
New submission from Armin Rigo: Can you guess why importing the attached x.py does nothing, without printing hello at all? The real issue shown in that example is that 'return' and 'yield' outside a function are ignored instead of giving a SyntaxError if they are optimized away by 'if 0:'.

[issue1875] if 0: return not raising SyntaxError

2008-01-19 Thread Maciek Fijalkowski
Changes by Maciek Fijalkowski: -- nosy: +cfbolz, fijal __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1875 __ ___ Python-bugs-list mailing list Unsubscribe: