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 <>
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.

if x or True:

is (in master) transformed to:


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."
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: <>
2021-01-13 16:47:49Mark.Shannonlinkissue42899 messages
2021-01-13 16:47:48Mark.Shannoncreate