Visitar URL original
[3.11] bpo-35191: Fix unexpected integer truncation in socket.setblocking() by izbyshev · Pull Request #10415 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20250624135546/https://github.com/python/cpython/pull/10415
Skip to content

[3.11] bpo-35191: Fix unexpected integer truncation in socket.setblocking() #10415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 1, 2023

Conversation

izbyshev
Copy link
Contributor

@izbyshev izbyshev commented Nov 8, 2018 •

On platforms with 64-bit long, socket.setblocking(x) treated all x
which lower 32 bits are zero as False due to integer truncation.

Reported by ubsan.

https://bugs.python.org/issue35191

@benjaminp
Copy link
Contributor

It seems like we could further and make the block argument to internal_setblocking a real C bool.

@serhiy-storchaka
Copy link
Member

It was fixed in #15609. PyObject_IsTrue() is now used instead of PyLong_AsLong().

Alexey Izbyshev added 3 commits December 1, 2023 14:58
On platforms with 64-bit long, socket.setblocking(x) treated all x
which lower 32 bits are zero as False due to integer truncation.

Reported by ubsan.
@serhiy-storchaka serhiy-storchaka changed the title bpo-35191: Fix unexpected integer truncation in socket.setblocking() [3.11] bpo-35191: Fix unexpected integer truncation in socket.setblocking() Dec 1, 2023
@serhiy-storchaka
Copy link
Member

Rebased on 3.11 which still is not fixed.

@vstinner
Copy link
Member

vstinner commented Dec 1, 2023

@serhiy-storchaka: Maybe you made a mistake, since suddenly, the change started to change 1723 files :-D

This PR is for the 3.11 branch. Maybe a new PR for the main branch should be written instead?

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

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.

7 participants