Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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