Skip to content

[3.14] gh-143050: Correct PyLong_FromString() to use _PyLong_Negate() (GH-145901)#147331

Merged
vstinner merged 1 commit intopython:3.14from
miss-islington:backport-db5936c-3.14
Mar 31, 2026
Merged

[3.14] gh-143050: Correct PyLong_FromString() to use _PyLong_Negate() (GH-145901)#147331
vstinner merged 1 commit intopython:3.14from
miss-islington:backport-db5936c-3.14

Conversation

@miss-islington
Copy link
Copy Markdown
Contributor

@miss-islington miss-islington commented Mar 31, 2026

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 db5936c)

Co-authored-by: Sergey B Kirpichev skirpichev@gmail.com
Co-authored-by: Victor Stinner vstinner@python.org

…ythonGH-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 db5936c)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
@vstinner vstinner merged commit 25b48b8 into python:3.14 Mar 31, 2026
50 checks passed
@miss-islington miss-islington deleted the backport-db5936c-3.14 branch March 31, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants