bpo-31106: Fix handling of erros in posix_fallocate() (#3000) by socketpair · Pull Request #3000 · python/cpython

Choose a reason for hiding this comment

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

Thanks for the patch! I'd like just a few small changes.

I understand why you just assign to errno the way you did, but I think we can do a little better. Instead, please change the "errno == EINTR" to "result == EINTR" in both functions, and only assign to errno immediately before calling posix_error(). (It's reasonable to assign to errno there because of how posix_error() works.)

Note that we can safely assign to errno outside ALLOW_THREADS, because errno is per-thread (using amazing magic).

I wish I knew why these functions don't assign to errno...!