Show More
@@ -1176,9 +1176,6 b' static PyObject *posixfile(PyObject *sel' | |||||
1176 | char fpmode[4]; |
|
1176 | char fpmode[4]; | |
1177 | int fppos = 0; |
|
1177 | int fppos = 0; | |
1178 | int plus; |
|
1178 | int plus; | |
1179 | #ifndef IS_PY3K |
|
|||
1180 | FILE *fp; |
|
|||
1181 | #endif |
|
|||
1182 |
|
1179 | |||
1183 | if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|yi:posixfile", |
|
1180 | if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|yi:posixfile", | |
1184 | kwlist, |
|
1181 | kwlist, | |
@@ -1250,26 +1247,9 b' static PyObject *posixfile(PyObject *sel' | |||||
1250 | PyErr_SetFromErrnoWithFilename(PyExc_IOError, name); |
|
1247 | PyErr_SetFromErrnoWithFilename(PyExc_IOError, name); | |
1251 | goto bail; |
|
1248 | goto bail; | |
1252 | } |
|
1249 | } | |
1253 | #ifndef IS_PY3K |
|
|||
1254 | fp = _fdopen(fd, fpmode); |
|
|||
1255 | if (fp == NULL) { |
|
|||
1256 | _close(fd); |
|
|||
1257 | PyErr_SetFromErrnoWithFilename(PyExc_IOError, name); |
|
|||
1258 | goto bail; |
|
|||
1259 | } |
|
|||
1260 |
|
||||
1261 | file_obj = PyFile_FromFile(fp, name, mode, fclose); |
|
|||
1262 | if (file_obj == NULL) { |
|
|||
1263 | fclose(fp); |
|
|||
1264 | goto bail; |
|
|||
1265 | } |
|
|||
1266 |
|
||||
1267 | PyFile_SetBufSize(file_obj, bufsize); |
|
|||
1268 | #else |
|
|||
1269 | file_obj = PyFile_FromFd(fd, name, mode, bufsize, NULL, NULL, NULL, 1); |
|
1250 | file_obj = PyFile_FromFd(fd, name, mode, bufsize, NULL, NULL, NULL, 1); | |
1270 | if (file_obj == NULL) |
|
1251 | if (file_obj == NULL) | |
1271 | goto bail; |
|
1252 | goto bail; | |
1272 | #endif |
|
|||
1273 | bail: |
|
1253 | bail: | |
1274 | PyMem_Free(name); |
|
1254 | PyMem_Free(name); | |
1275 | return file_obj; |
|
1255 | return file_obj; |
General Comments 0
You need to be logged in to leave comments.
Login now