◐ Shell
clean mode source ↗

gh-90716: add _pylong.py module by nascheme · Pull Request #96673 · python/cpython

tim-one

Add Python implementations of certain longobject.c functions. These use
asymptotically faster algorithms that can be used for operations on
integers with many digits. In those cases, the performance overhead of
the Python implementation is not significant since the asymptotic
behavior is what dominates runtime. Functions provided by this module
should be considered private and not part of any public API.

Co-author: Tim Peters <tim.peters@gmail.com>
Co-author: Mark Dickinson <dickinsm@gmail.com>
Co-author: Bjorn Martinsson
Code from Bjorn Martinsson.
Another optimization from Bjorn.  Adjust threshold limits in
longobject.c since the _pylong version is faster.

gpshead added a commit to gpshead/cpython that referenced this pull request

Nov 3, 2022
* Properly decref on _pylong import error.
* Improve the error message on _pylong TypeError.
* Tie the return value comments together.

These are minor followups to issues not caught among the reviewers on
python#96673.

gpshead added a commit that referenced this pull request

Nov 3, 2022
* Properly decref on _pylong import error.
* Improve the error message on _pylong TypeError.
* Fix the assertion error in pydebug builds to be a TypeError.
* Tie the return value comments together.

These are minor followups to issues not caught among the reviewers on
#96673.