Mercurial > cpython-lru_cache-weakref
diff Mac/Modules/macmodule.c @ 27158:eb6b36b26e8d legacy-trunk
Merging the various tweaks for MacPython-OS9 2.3a1 back into the trunk.
| author | Jack Jansen <jack.jansen@cwi.nl> |
|---|---|
| date | Wed, 08 Jan 2003 16:27:44 +0000 |
| parents | 74d1ad61f843 |
| children |
line wrap: on
line diff
--- a/Mac/Modules/macmodule.c Wed Jan 08 15:14:55 2003 +0000 +++ b/Mac/Modules/macmodule.c Wed Jan 08 16:27:44 2003 +0000 @@ -218,16 +218,21 @@ { extern int fclose(FILE *); int fd; - char *mode; + char *mode = "r"; + int bufsize = -1; FILE *fp; - if (!PyArg_ParseTuple(args, "is", &fd, &mode)) + PyObject *f; + if (!PyArg_ParseTuple(args, "i|si", &fd, &mode, &bufsize)) return NULL; Py_BEGIN_ALLOW_THREADS fp = fdopen(fd, mode); Py_END_ALLOW_THREADS if (fp == NULL) return mac_error(); - return PyFile_FromFile(fp, "(fdopen)", mode, fclose); + f = PyFile_FromFile(fp, "<fdopen>", mode, fclose); + if (f != NULL) + PyFile_SetBufSize(f, bufsize); + return f; } #endif
