diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-18 01:39:23 +0100 |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-18 01:39:23 +0100 |
| commit | e42ccd2bfd7a05a02c1020b819e4ee5b26041d01 (patch) | |
| tree | 071843848770176c8aed3f965d783738182847c3 /Modules/_ssl.c | |
| parent | a555cfcb73cf677a99d29af6fa0bcfe4c35a2aeb (diff) | |
| download | cpython-git-e42ccd2bfd7a05a02c1020b819e4ee5b26041d01.tar.gz | |
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()
Diffstat (limited to 'Modules/_ssl.c')
| -rw-r--r-- | Modules/_ssl.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 8596225cbf..fb03513d89 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -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); |
