[issue25843] code_richcompare() don't use constant type when comparing code constants

STINNER Victor report at bugs.python.org
Thu Jan 21 07:49:06 EST 2016


STINNER Victor added the comment:

Updated patch version 5.

> I meant that set shouldn't be handled in _PyCode_ConstantKey at all. Only frozenset constants can be considered equal. Sets as well as lists all should be different.

Ok, I dropped support for set type to only keep support for frozenset. set are now always considered as different, as list and other "unsupported types".

> There is yet one issue with string and bytes literals. When run Python with the -b option:
> (...)
> May be the type should be the first item in the key.

Oh, good catch. It's an old bug.

Yeah, putting the type as the first parameter fixes the issue. I made this change. I had to update compile.c to exchange the type and the value in the tuple.

----------
Added file: http://bugs.python.org/file41682/code_richcompare-5.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25843>
_______________________________________


More information about the Python-bugs-list mailing list