[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

Steve Stagg report at bugs.python.org
Wed Jan 13 10:42:59 EST 2021


Steve Stagg <stestagg at gmail.com> added the comment:

Oops, sorry, didn't realise there were such rules.  

The reasoning for me making the change to the title is that that the original PR didn't mention skipping actual condition logic, but does mention skipping unreachable blocks, with the examples provided (either by accident or intent) showing cases where the condition was still included.

I thus assumed the change that has been implemented had bad unintended side-effects (a bug), so wanted to capture that and, if any consensus on allowing the optimizer to skip bool() calls is ever reached on the mailing list, an explicit issue would be raised to cover that change.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42899>
_______________________________________


More information about the Python-bugs-list mailing list