[New-bugs-announce] [issue33299] Return an object itself for some types in _PyCode_ConstantKey()

Serhiy Storchaka report at bugs.python.org
Tue Apr 17 12:54:12 EDT 2018


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

_PyCode_ConstantKey() wraps a constant into a tuple that contains other items besides the wrapped object. This makes booleans different from 0 and 1, makes numbers of different type different (1, 1.0 and 1.0+0j), makes floating point zeros with different signs different (0.0 and -0.0), and avoids a ByteWarning from comparing strings and bytes.

But for some types objects are always different from objects of other types and from tuples. _PyCode_ConstantKey() can be made faster and using less memory if return the object of these types unwrapped.

----------
components: Interpreter Core
messages: 315407
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Return an object itself for some types in _PyCode_ConstantKey()
type: performance
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33299>
_______________________________________


More information about the New-bugs-announce mailing list