summaryrefslogtreecommitdiffstats
path: root/Mac/Modules
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-01-08 16:27:44 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2003-01-08 16:27:44 (GMT)
commit3e82872ecaa642ff8bab89c4323d1c3b09981665 (patch)
treed0987955c48352ec147d6ad0113fe4845a578546 /Mac/Modules
parent6c64fa7ddadd7a3a24e8ddab7fd4ed9236fef1c3 (diff)
downloadcpython-3e82872ecaa642ff8bab89c4323d1c3b09981665.zip
cpython-3e82872ecaa642ff8bab89c4323d1c3b09981665.tar.gz
cpython-3e82872ecaa642ff8bab89c4323d1c3b09981665.tar.bz2
Merging the various tweaks for MacPython-OS9 2.3a1 back into the trunk.
Diffstat (limited to 'Mac/Modules')
-rw-r--r--Mac/Modules/macmodule.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/Mac/Modules/macmodule.c b/Mac/Modules/macmodule.c
index e6ac881..fb62286 100644
--- a/Mac/Modules/macmodule.c
+++ b/Mac/Modules/macmodule.c
@@ -218,16 +218,21 @@ mac_fdopen(self, args)
{
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