This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Return an object itself for some types in _PyCode_ConstantKey()
Type: performance Stage: resolved
Components: Interpreter Core Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2018-04-17 16:54 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 6513 merged serhiy.storchaka, 2018-04-17 16:56
Messages (2)
msg315407 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-04-17 16:54
_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.
msg315477 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-04-19 05:28
New changeset b7e1eff8436f6e0c4aac440036092fcf96f82960 by Serhiy Storchaka in branch 'master':
bpo-33299: Return an object itself for some types in _PyCode_ConstantKey(). (GH-6513)
https://github.com/python/cpython/commit/b7e1eff8436f6e0c4aac440036092fcf96f82960
History
Date User Action Args
2022-04-11 14:58:59adminsetgithub: 77480
2018-04-19 05:28:42serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-04-19 05:28:07serhiy.storchakasetmessages: + msg315477
2018-04-17 16:56:31serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request6206
2018-04-17 16:54:22serhiy.storchakasetnosy: + vstinner
2018-04-17 16:54:12serhiy.storchakacreate