]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-143050: Correct PyLong_FromString() to use _PyLong_Negate() (#145901)
authorSergey B Kirpichev <skirpichev@gmail.com>
Tue, 31 Mar 2026 13:17:49 +0000 (16:17 +0300)
committerGitHub <noreply@github.com>
Tue, 31 Mar 2026 13:17:49 +0000 (13:17 +0000)
commitdb5936c5b89aa19e04d63120e0cf5bbc73bf2420
tree843fcb87a4761f840d9577860e4a4bf9260c74ba
parent829e4d0b14e077b9a8dac2877483c261aa4bbe1a
gh-143050: Correct PyLong_FromString() to use _PyLong_Negate() (#145901)

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>
Include/internal/pycore_long.h
Lib/test/test_capi/test_long.py
Modules/_testcapi/immortal.c
Objects/longobject.c