[issue32510] Broken comparisons (probably caused by wrong caching of values)

2018-01-07 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

Oh, by the way... are you aware that the Recursor class defines a class 
attribute `branches` which is shared by all instances? You create multiple 
recursor objects, but they all share the same `branches` attribute. That might 
be intentional, but if not, that might explain the unexpected behaviour you are 
seeing.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32510] Broken comparisons (probably caused by wrong caching of values)

2018-01-07 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

That is nearly two hundred lines of quite complex code. What results are you 
expecting and what results are you getting?

I've just tried running it under Python 3.3 and 3.5 on a RedHat-based Linux, 
and after generating a large amount of output (271315 lines, including 
"IMPOSSIBLE CONDITION OCCURED!" 552 times) it raised KeyError.

I then tried again on an Ubuntu-based Linux, and got the same result.

Can you demonstrate the same problem with a smaller, simpler example? What 
reasons do you have for believing that this is caused by "wrong caching of 
values"? What values do you think are being cached, and where?

You say:

"Comparisons fail, although they logically need to succeed."

Which comparisons? Can you isolate those failing comparisons without all the 
extraneous code?

"Integers magically increase without ever being written to in the code after 
initially assigned in the constructor."

Which integers? What evidence do you have that they are changing?

Bottom line is, while it is conceivable that you've found an interpreter bug 
that exists in at least three versions of Python, going back many years, that 
nobody has noticed before, I think it is far more likely that the bug is in 
your code. I'm going to close this ticket for now, but if you have answers for 
my questions and good evidence of an interpreter bug (preferably with a short 
and simple demonstration, see http://sscce.org/) please feel free to re-open it.

Thank you.

--
nosy: +steven.daprano
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32510] Broken comparisons (probably caused by wrong caching of values)

2018-01-07 Thread Thermi

New submission from Thermi :

With Python 3.6.4 on Arch Linux, on three different hosts (one Skylake CPU, one 
i7-3820, one Xeon E5-2680, all running Arch Linux with the same Python 
version), the Python 3 interpreter behaves erratically in a script of mine.

The following symptoms occur:
1) Comparisons fail, although they logically need to succeed. The comparisons 
work a lot of the times, but sometimes, they don't.
2) Integers magically increase without ever being written to in the code after 
initially assigned in the constructor.

The behaviour changes if code is rearranged, variables and lines are added that 
do not pertain the broken comparisons, making accidental writes to memory or 
reads from unitialized memory likely.

The breakage occurs in the code between line 114 and the execution of the code 
in the recurse() method of the class Branch.

The script is here 
(https://gist.github.com/Thermi/05bc671436841670ac81b3b86217dd62). It basically 
only does some arithmetic with translation tables.

--
components: Interpreter Core
messages: 309619
nosy: Thermi
priority: normal
severity: normal
status: open
title: Broken comparisons (probably caused by wrong caching of values)
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com