gh-110093: Replace trivial Py_BuildValue() with direct C API call (GH-110094)

This commit is contained in:
Serhiy Storchaka 2023-10-20 18:08:41 +03:00 committed by GitHub
parent ff4e53cb74
commit 59ea0f523e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 33 additions and 32 deletions

View file

@ -11276,9 +11276,9 @@ os_sendfile_impl(PyObject *module, int out_fd, int in_fd, PyObject *offobj,
done:
#if !defined(HAVE_LARGEFILE_SUPPORT)
return Py_BuildValue("l", sbytes);
return PyLong_FromLong(sbytes);
#else
return Py_BuildValue("L", sbytes);
return PyLong_FromLongLong(sbytes);
#endif
#else
@ -11291,7 +11291,7 @@ done:
} while (ret < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
if (ret < 0)
return (!async_err) ? posix_error() : NULL;
return Py_BuildValue("n", ret);
return PyLong_FromSsize_t(ret);
}
#endif
off_t offset;
@ -11312,7 +11312,7 @@ done:
return (!async_err) ? posix_error() : NULL;
if (offset >= st.st_size) {
return Py_BuildValue("i", 0);
return PyLong_FromLong(0);
}
// On illumos specifically sendfile() may perform a partial write but
@ -11338,7 +11338,7 @@ done:
} while (ret < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
if (ret < 0)
return (!async_err) ? posix_error() : NULL;
return Py_BuildValue("n", ret);
return PyLong_FromSsize_t(ret);
#endif
}
#endif /* HAVE_SENDFILE */