summaryrefslogtreecommitdiffstats
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-10-22 00:09:51 (GMT)
committerGuido van Rossum <guido@python.org>2007-10-22 00:09:51 (GMT)
commit40d20bcf1fccfe8af2393f1aec88ba18e38d0bc1 (patch)
tree0d6616333b9c3cb004b659751fe9baa4bac67ad2 /Objects/fileobject.c
parentc2954e5273520031d3debfac8c668b9e611303b3 (diff)
downloadcpython-40d20bcf1fccfe8af2393f1aec88ba18e38d0bc1.zip
cpython-40d20bcf1fccfe8af2393f1aec88ba18e38d0bc1.tar.gz
cpython-40d20bcf1fccfe8af2393f1aec88ba18e38d0bc1.tar.bz2
Issue 1267, continued.
Additional patch by Christian Heimes to deal more cleanly with the FILE* vs file-descriptor issues. I cleaned up his code a bit, and moved the lseek() call into import.c.
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r--Objects/fileobject.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index b6d200d..b4abac5 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -26,22 +26,16 @@ extern "C" {
/* External C interface */
PyObject *
-PyFile_FromFile(FILE *fp, char *name, char *mode, int (*close)(FILE *))
+PyFile_FromFd(int fd, char *name, char *mode, int buffering, char *encoding,
+ char *newline)
{
- return PyFile_FromFileEx(fp, name, mode, close, -1, NULL, NULL);
-}
-
-PyObject *
-PyFile_FromFileEx(FILE *fp, char *name, char *mode, int (*close)(FILE *),
- int buffering, char *encoding, char *newline)
-{
- PyObject *io, *stream, *nameobj=NULL;
+ PyObject *io, *stream, *nameobj = NULL;
io = PyImport_ImportModule("io");
if (io == NULL)
return NULL;
- stream = PyObject_CallMethod(io, "open", "isiss", fileno(fp), mode,
- buffering, encoding, newline);
+ stream = PyObject_CallMethod(io, "open", "isiss", fd, mode,
+ buffering, encoding, newline);
Py_DECREF(io);
if (stream == NULL)
return NULL;