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
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index 2d0dd09..34e68c7 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -116,11 +116,8 @@
provides a special ioctl() for non-blocking read/write, which is
exposed via oss_nonblock() below. */
fd = _Py_open(devicename, imode|O_NONBLOCK);
-
- if (fd == -1) {
- PyErr_SetFromErrnoWithFilename(PyExc_IOError, devicename);
+ if (fd == -1)
return NULL;
- }
/* And (try to) put it back in blocking mode so we get the
expected write() semantics. */
@@ -180,10 +177,8 @@
}
fd = _Py_open(devicename, O_RDWR);
- if (fd == -1) {
- PyErr_SetFromErrnoWithFilename(PyExc_IOError, devicename);
+ if (fd == -1)
return NULL;
- }
if ((self = PyObject_New(oss_mixer_t, &OSSMixerType)) == NULL) {
close(fd);