mirror of
https://github.com/python/cpython.git
synced 2025-09-04 16:01:10 +00:00
Add an errors parameter to open() and TextIOWrapper() to specify error handling.
This commit is contained in:
parent
c6fe37bab9
commit
e7fc50f2d0
7 changed files with 77 additions and 17 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue