Author Mark.Shannon
Recipients Mark.Shannon, Mohamed_Atef, ethan.furman, gregory.p.smith, gvanrossum, josh.r, pablogsal, serhiy.storchaka, stestagg
Date 2021-01-13.16:47:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1610556469.6.0.100918596866.issue42899@roundup.psfhosted.org>
In-reply-to
Content
The problem with using a specific syntax example, is that the optimizer doesn't work that way. It works on the CFG.

Any specification needs to be phrased in terms of general control flow, as other optimizations can enable this transformation.
e.g. 

if x or True:
    do_something()

is (in master) transformed to:

x
do_something()

I think your earlier suggestion of
"So I think dropping an *extra* call is fine, while dropping the *only* call is not."
is the best way to preserve 3.9 behavior.
It can be formalised as:
"The implementation is allowed to skip any boolean tests of a value, when it has effect on the flow of the program and at least one test has already been performed on that value."
History
Date User Action Args
2021-01-13 16:47:49Mark.Shannonsetrecipients: + Mark.Shannon, gvanrossum, gregory.p.smith, ethan.furman, serhiy.storchaka, josh.r, Mohamed_Atef, pablogsal, stestagg
2021-01-13 16:47:49Mark.Shannonsetmessageid: <1610556469.6.0.100918596866.issue42899@roundup.psfhosted.org>
2021-01-13 16:47:49Mark.Shannonlinkissue42899 messages
2021-01-13 16:47:48Mark.Shannoncreate