Open
Description
In Python 2 int
s and long
s were different objects, and the design of each was tailored to the different size and use cases.
In Python3 we dropped the distinction, but we also dropped the design for int
s that fit into a single word.
We have added various fast paths for "medium" integers (e.g. #89109) but the underlying data structure gets in the way.
We should layout the int/long object so that it supports fast operations for most integers.
See faster-cpython/ideas#548 for a fuller discussion
Linked PRs
- GH-101291: Refactor the
PyLongObject
struct #101292 - GH-101291: Low level opt-in API for pylong #101685
- GH-101291: Rearrange the size bits in PyLongObject #102464
- GH-101291: Avoid using macros with casts in low-level long API. #104742
- [3.12] GH-101291: Avoid using macros with casts in low-level long API. (GH-104742) #104759
- GH-101291: Add warning to "what's new" that
PyLongObject
internals have changed. #107388 - [3.12] GH-101291: Add warning to "what's new" that
PyLongObject
internals have changed. (GH-107388) #107392 - gh-101291: Add versionadded directives for PyUnstable_Long_* #125384
- [3.13] gh-101291: Add versionadded directives for PyUnstable_Long_* (GH-125384) #125407
- [3.12] gh-101291: Add versionadded directives for PyUnstable_Long_* (GH-125384) #125408
Metadata
Metadata
Assignees
Labels
(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)Performance or resource usagePerformance or resource usage