cpython: bc2a22eaa0af (original) (raw)
Mercurial > cpython
changeset 95269:bc2a22eaa0af
Issue #23752: When built from an existing file descriptor, io.FileIO() now only calls fstat() once. Before fstat() was called twice, which was not necessary. [#23752]
Victor Stinner victor.stinner@gmail.com | |
---|---|
date | Mon, 30 Mar 2015 03:21:06 +0200 |
parents | 49d3ff81f31f |
children | fe9a578d5f38 |
files | Misc/NEWS Modules/_io/fileio.c |
diffstat | 2 files changed, 26 insertions(+), 24 deletions(-)[+] [-] Misc/NEWS 26 Modules/_io/fileio.c 24 |
line wrap: on
line diff
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,6 +2,32 @@ Python News +++++++++++ +What's New in Python 3.5.0 alpha 4? +=================================== + +Release date: XXX + +Core and Builtins +----------------- + +Library +------- + +- Issue #23752: When built from an existing file descriptor, io.FileIO() now
- only calls fstat() once. Before fstat() was called twice, which was not
- necessary. + +Build +----- + +Tests +----- + +Tools/Demos +----------- + + + What's New in Python 3.5.0 alpha 3? ===================================
--- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -177,28 +177,6 @@ fileio_new(PyTypeObject *type, PyObject return (PyObject *) self; } -static int -check_fd(int fd) -{
GetLastError() == ERROR_INVALID_HANDLE[](#l2.13)
errno == EBADF[](#l2.15)
) {[](#l2.17)
PyObject *exc;[](#l2.18)
char *msg = strerror(EBADF);[](#l2.19)
exc = PyObject_CallFunction(PyExc_OSError, "(is)",[](#l2.20)
EBADF, msg);[](#l2.21)
PyErr_SetObject(PyExc_OSError, exc);[](#l2.22)
Py_XDECREF(exc);[](#l2.23)
return -1;[](#l2.24)
- }
- return 0;
-} - #ifdef O_CLOEXEC extern int _Py_open_cloexec_works; #endif @@ -355,8 +333,6 @@ fileio_init(PyObject *oself, PyObject *a #endif if (fd >= 0) {