Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 457a229

Browse files
committed
SSLContext.load_dh_params() now properly closes the input file.
1 parent 69db587 commit 457a229

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ Core and Builtins
147147
Library
148148
-------
149149

150+
- SSLContext.load_dh_params() now properly closes the input file.
151+
150152
- Issue #16829: IDLE printing no longer fails if there are spaces or other
151153
special characters in the file path.
152154

Modules/_ssl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2177,6 +2177,7 @@ load_dh_params(PySSLContext *self, PyObject *filepath)
21772177
errno = 0;
21782178
PySSL_BEGIN_ALLOW_THREADS
21792179
dh = PEM_read_DHparams(f, NULL, NULL, NULL);
2180+
fclose(f);
21802181
PySSL_END_ALLOW_THREADS
21812182
if (dh == NULL) {
21822183
if (errno != 0) {

0 commit comments

Comments
 (0)