# HG changeset patch # User Gregory Szorc # Date 2022-02-20 22:45:51 # Node ID e9ca736f5b521520e02e343f10306a5cfa5adf0f # Parent 41bd7e8fc82eaa675b92d6610de6b27a72f0c5c4 cext: remove Python 2 file handling code Differential Revision: https://phab.mercurial-scm.org/D12226 diff --git a/mercurial/cext/osutil.c b/mercurial/cext/osutil.c --- a/mercurial/cext/osutil.c +++ b/mercurial/cext/osutil.c @@ -1219,9 +1219,7 @@ static PyObject *posixfile(PyObject *sel char fpmode[4]; int fppos = 0; int plus; -#ifndef IS_PY3K FILE *fp; -#endif if (!PyArg_ParseTupleAndKeywords(args, kwds, PY23("et|si:posixfile", "et|yi:posixfile"), @@ -1294,7 +1292,6 @@ static PyObject *posixfile(PyObject *sel PyErr_SetFromErrnoWithFilename(PyExc_IOError, name); goto bail; } -#ifndef IS_PY3K fp = _fdopen(fd, fpmode); if (fp == NULL) { _close(fd); @@ -1309,11 +1306,6 @@ static PyObject *posixfile(PyObject *sel } PyFile_SetBufSize(file_obj, bufsize); -#else - file_obj = PyFile_FromFd(fd, name, mode, bufsize, NULL, NULL, NULL, 1); - if (file_obj == NULL) - goto bail; -#endif bail: PyMem_Free(name); return file_obj;