New submission from David Vieira-Kurz: Python internal compare function does not verify if a comparison of two objects is done by using object of the same type.
In this case python does not know how to compare DECIMAL and FLOATS and returns a FALSE instead of returning an Error. Python should have strict rules to only allow comparison between objects is aware of but depending on the version of Python we have different behaviors: # Output: # Python 2.6.5 32bit -- WRONG: FLOAT seems comparable with DECIMAL (WRONG) # Python 2.7.2 32bit -- WRONG: FLOAT seems comparable with DECIMAL (WRONG) # Python 3.1.2 32bit -- CORRECT: FLOAT is NOT comparable with DECIMAL (CORRECT) # Python 3.4.0 ([GCC 4.8.2] on linux) 32bit -- WRONG: FLOAT seems comparable with DECIMAL (WRONG) A proof of concept code-snippet is attached. ---------- components: Interpreter Core files: python-float-decimal-comparison.txt messages: 237632 nosy: secalert priority: normal severity: normal status: open title: cross-type comparison is different in python minor versions type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file38405/python-float-decimal-comparison.txt _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23620> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com