]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-143050: Correct PyLong_FromString() to use _PyLong_Negate() (#145901) ...
authorVictor Stinner <vstinner@python.org>
Tue, 31 Mar 2026 15:06:38 +0000 (17:06 +0200)
committerGitHub <noreply@github.com>
Tue, 31 Mar 2026 15:06:38 +0000 (17:06 +0200)
commit01af34a3649b34eb2b5e43ccbd106a8a88d9fc47
tree399a61eb4b9b963689ef61daf8fde2df6f090415
parentfc1c6446ce80b547de6214ed4970b061695f94b8
[3.13] gh-143050: Correct PyLong_FromString() to use _PyLong_Negate() (#145901) (#147437)

The long_from_string_base() might return a small integer, when the
_pylong.py is used to do conversion.  Hence, we must be careful here to
not smash it "small int" bit by using the _PyLong_FlipSign().

Co-authored-by: Victor Stinner <vstinner@python.org>
(cherry picked from commit db5936c5b89aa19e04d63120e0cf5bbc73bf2420)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Include/internal/pycore_long.h
Lib/test/test_capi/test_long.py
Modules/_testcapi/immortal.c
Objects/longobject.c