mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #23694: Enhance _Py_fopen(), it now raises an exception on error
* If fopen() fails, OSError is raised with the original filename object. * The GIL is now released while calling fopen()
This commit is contained in:
parent
a555cfcb73
commit
e42ccd2bfd
5 changed files with 44 additions and 24 deletions
|
@ -2941,11 +2941,9 @@ load_dh_params(PySSLContext *self, PyObject *filepath)
|
|||
DH *dh;
|
||||
|
||||
f = _Py_fopen_obj(filepath, "rb");
|
||||
if (f == NULL) {
|
||||
if (!PyErr_Occurred())
|
||||
PyErr_SetFromErrnoWithFilenameObject(PyExc_OSError, filepath);
|
||||
if (f == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
PySSL_BEGIN_ALLOW_THREADS
|
||||
dh = PEM_read_DHparams(f, NULL, NULL, NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue