New submission from Orion Fisher <ocfi...@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
files: bug_occurence.py
messages: 362612
nosy: Orion Fisher
priority: normal
severity: normal
status: open
title: Inappropriate short circuit relating to inequality comparison and 
membership test
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file48911/bug_occurence.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39746>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to