]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-143050: Correct PyLong_FromString() to use _PyLong_Negate() (GH-145901...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 31 Mar 2026 14:14:12 +0000 (16:14 +0200)
committerGitHub <noreply@github.com>
Tue, 31 Mar 2026 14:14:12 +0000 (16:14 +0200)
commit25b48b84b85a08384479d2636a01d1d52fa97a6b
tree86ba6ced15c2b7a27893d42e9d3abf76434f7e16
parente387bac1a4a36c1b5c7899d1e79d6d424fae7b85
[3.14] gh-143050: Correct PyLong_FromString() to use _PyLong_Negate() (GH-145901) (#147331)

gh-143050: Correct PyLong_FromString() to use _PyLong_Negate() (GH-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().
(cherry picked from commit db5936c5b89aa19e04d63120e0cf5bbc73bf2420)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
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