[New-bugs-announce] [issue39746] Inappropriate short circuit relating to inequality comparison and membership test
report at bugs.python.org
Mon Feb 24 22:08:43 EST 2020
New submission from Orion Fisher <OCFI222 at g.uky.edu>:
I found a strange issue with how the interpreter produces bytecode for an expression like True != True in [False, False].
Reading it, one would expect the value of the expression to be True, whether the inequality comparison is evaluated first, or the membership test is evaluated first. Indeed, when parentheses are used to control the order of execution these results do occur.
However, without any parentheses, the result is False. The underlying cause seems to be in a short circuit which is dependent on the inequality comparison, seen in the JUMP_IF_FALSE_OR_POP instruction.
This expression is very synthetic, but I am submitting this bug under the worry that it speaks to a more significant error in the bytecode produced for inequality tests (or membership tests).
components: Interpreter Core
nosy: Orion Fisher
title: Inappropriate short circuit relating to inequality comparison and membership test
versions: Python 3.8
Added file: https://bugs.python.org/file48911/bug_occurence.py
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce