mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Issue #23694: Enhance _Py_open(), it now raises exceptions
* _Py_open() now raises exceptions on error. If open() fails, it raises an OSError with the filename. * _Py_open() now releases the GIL while calling open() * Add _Py_open_noraise() when _Py_open() cannot be used because the GIL is not held
This commit is contained in:
parent
6562b29e13
commit
a555cfcb73
8 changed files with 71 additions and 45 deletions
|
@ -257,6 +257,7 @@ _close_open_fds_safe(int start_fd, PyObject* py_fds_to_keep)
|
|||
fd_dir_fd = _Py_open(FD_DIR, O_RDONLY);
|
||||
if (fd_dir_fd == -1) {
|
||||
/* No way to get a list of open fds. */
|
||||
PyErr_Clear();
|
||||
_close_fds_by_brute_force(start_fd, py_fds_to_keep);
|
||||
return;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue