mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Merging the various tweaks for MacPython-OS9 2.3a1 back into the trunk.
This commit is contained in:
parent
6c64fa7dda
commit
3e82872eca
27 changed files with 220 additions and 290 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue