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 ❌ .

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Miss Islington really should sign the CLA.

@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 72114c0 into python:3.10 Apr 14, 2022
@miss-islington miss-islington deleted the backport-0859368-3.10 branch April 14, 2022 01:38
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