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