X Tutup
The Wayback Machine - https://web.archive.org/web/20260106002441/https://github.com/python/cpython/pull/91493
Skip to content

Conversation

@miss-islington
Copy link
Contributor

The left-hand side expression of the if-check can be converted to a
constant by the compiler, but the addition on the right-hand side is
performed during runtime.

Move the addition from the right-hand side to the left-hand side by
turning it into a subtraction there. Since the values are known to
be large enough to not turn negative, this is a safe operation.

Prevents a very unlikely integer overflow on 32 bit systems.

Fixes GH-91421.
(cherry picked from commit 0859368)

Co-authored-by: Tobias Stoeckmann stoeckmann@users.noreply.github.com

The left-hand side expression of the if-check can be converted to a
constant by the compiler, but the addition on the right-hand side is
performed during runtime.

Move the addition from the right-hand side to the left-hand side by
turning it into a subtraction there. Since the values are known to
be large enough to not turn negative, this is a safe operation.

Prevents a very unlikely integer overflow on 32 bit systems.

Fixes pythonGH-91421.
(cherry picked from commit 0859368)

Co-authored-by: Tobias Stoeckmann <stoeckmann@users.noreply.github.com>
@ghost
Copy link

ghost commented Apr 13, 2022

All commit authors signed the Contributor License Agreement.
CLA signed

@miss-islington
Copy link
Contributor Author

@stoeckmann and @JelleZijlstra: Status check is done, and it's a failure ❌ .

@miss-islington
Copy link
Contributor Author

@stoeckmann and @JelleZijlstra: Status check is done, and it's a failure ❌ .

@miss-islington
Copy link
Contributor Author

@stoeckmann and @JelleZijlstra: Status check is done, and it's a success ✅ .

@JelleZijlstra JelleZijlstra merged commit edf1a77 into python:3.9 Apr 14, 2022
@miss-islington miss-islington deleted the backport-0859368-3.9 branch April 14, 2022 01:38
hello-adam pushed a commit to hello-adam/cpython that referenced this pull request Jun 2, 2022
…) (pythonGH-91493)

The left-hand side expression of the if-check can be converted to a
constant by the compiler, but the addition on the right-hand side is
performed during runtime.

Move the addition from the right-hand side to the left-hand side by
turning it into a subtraction there. Since the values are known to
be large enough to not turn negative, this is a safe operation.

Prevents a very unlikely integer overflow on 32 bit systems.

Fixes pythonGH-91421.
(cherry picked from commit 0859368)

Co-authored-by: Tobias Stoeckmann <stoeckmann@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

X Tutup