Add an errors parameter to open() and TextIOWrapper() to specify error handling.

This commit is contained in:
Guido van Rossum 2007-12-03 22:54:21 +00:00
parent c6fe37bab9
commit e7fc50f2d0
7 changed files with 77 additions and 17 deletions

View file

@ -2602,7 +2602,7 @@ call_find_module(char *name, PyObject *path)
(char*)PyUnicode_GetDefaultEncoding();
}
fob = PyFile_FromFd(fd, pathname, fdp->mode, -1,
(char*)encoding, NULL, 1);
(char*)encoding, NULL, NULL, 1);
if (fob == NULL) {
close(fd);
PyMem_FREE(found_encoding);

View file

@ -770,7 +770,7 @@ initstdio(void)
#endif
}
else {
if (!(std = PyFile_FromFd(fd, "<stdin>", "r", -1, NULL,
if (!(std = PyFile_FromFd(fd, "<stdin>", "r", -1, NULL, NULL,
"\n", 0))) {
goto error;
}
@ -790,7 +790,7 @@ initstdio(void)
#endif
}
else {
if (!(std = PyFile_FromFd(fd, "<stdout>", "w", -1, NULL,
if (!(std = PyFile_FromFd(fd, "<stdout>", "w", -1, NULL, NULL,
"\n", 0))) {
goto error;
}
@ -811,7 +811,7 @@ initstdio(void)
#endif
}
else {
if (!(std = PyFile_FromFd(fd, "<stderr>", "w", -1, NULL,
if (!(std = PyFile_FromFd(fd, "<stderr>", "w", -1, NULL, NULL,
"\n", 0))) {
goto error;
}