Author terry.reedy
Recipients aldwinaldwin, lukasz.langa, miss-islington, ned.deily, nedbat, pablogsal, serhiy.storchaka, terry.reedy, xtreak
Date 2019-07-05.21:53:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1562363594.1.0.848998696355.issue37500@roundup.psfhosted.org>
In-reply-to
Content
I agree with Tim.  Detect SyntaxErrors in dead code if you can, but don't change the current code deletion, at least not without proper  discussion (which Pablo just started on pydev).  The latter is what I consider to be a release blocker needing release manager consideration.

I see optimizing away 'if __debug__: ...' clauses, when __debug__ is False (and 0) as currently documented language behavior, not a 'deep implementation detail'.
https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement
Assert statements are equivalent to 'if __debug__' clauses.  They are optimized away when __debug__ is False, when python is run with -0.

Given that False and True are 0 and 1 with extra behavior, it is not a stretch to infer that 'if 0:' clauses are optimized away, as they currently are (or were, until PR 13332).

To my mind, PR 13332 is either an enhancement or a bugfix + additional regressive behavior change that I do not believe is absolutely necessary.  In either case, I don't think it should have been applied as is in b2.  But that is past.  I think it should be either reverted or fixed before b3 to only detect SyntaxErrors without leaving code that should be removed.  I don't know how close PR 14116 comes to this.
History
Date User Action Args
2019-07-05 21:53:14terry.reedysetrecipients: + terry.reedy, nedbat, ned.deily, lukasz.langa, serhiy.storchaka, pablogsal, miss-islington, xtreak, aldwinaldwin
2019-07-05 21:53:14terry.reedysetmessageid: <1562363594.1.0.848998696355.issue37500@roundup.psfhosted.org>
2019-07-05 21:53:14terry.reedylinkissue37500 messages
2019-07-05 21:53:13terry.reedycreate