changeset 48906:e9ca736f5b52

cext: remove Python 2 file handling code Differential Revision: https://phab.mercurial-scm.org/D12226
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 20 Feb 2022 15:45:51 -0700
parents 41bd7e8fc82e
children 824b2082550e
files mercurial/cext/osutil.c
diffstat 1 files changed, 0 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cext/osutil.c	Sun Feb 20 15:45:16 2022 -0700
+++ b/mercurial/cext/osutil.c	Sun Feb 20 15:45:51 2022 -0700
@@ -1219,9 +1219,7 @@
 	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 @@
 		PyErr_SetFromErrnoWithFilename(PyExc_IOError, name);
 		goto bail;
 	}
-#ifndef IS_PY3K
 	fp = _fdopen(fd, fpmode);
 	if (fp == NULL) {
 		_close(fd);
@@ -1309,11 +1306,6 @@
 	}
 
 	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;