Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
``_ssl`` module: improve UWP compatibility.
11 changes: 7 additions & 4 deletions Modules/_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -4924,16 +4924,18 @@ static PyObject *
_ssl__SSLContext_load_dh_params_impl(PySSLContext *self, PyObject *filepath)
/*[clinic end generated code: output=dd74b3c524dd2723 input=832769a0734b8c4d]*/
{
FILE *f;
DH *dh;

#if !defined(MS_WINDOWS_DESKTOP) && defined(MS_WINDOWS_APP)
PyErr_SetString(PyExc_NotImplementedError, "load_dh_params: unavailable on UWP build");
return NULL;
#else
#if defined(MS_WINDOWS) && defined(Py_DEBUG)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact that we raise only on DEBUG MS builds is really weird here. Likewise, I would rather prefer an elif branch instead of a ifdef/else + nested.

PyErr_SetString(PyExc_NotImplementedError,
"load_dh_params: unavailable on Windows debug build");
return NULL;
#endif

f = Py_fopen(filepath, "rb");
FILE* f = Py_fopen(filepath, "rb");
DH* dh;
if (f == NULL)
return NULL;

Expand All @@ -4959,6 +4961,7 @@ _ssl__SSLContext_load_dh_params_impl(PySSLContext *self, PyObject *filepath)
}
DH_free(dh);
Py_RETURN_NONE;
#endif
}

/*[clinic input]
Expand Down
11 changes: 8 additions & 3 deletions Modules/_ssl/debughelpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,18 @@ static int
_PySSLContext_set_keylog_filename(PyObject *op, PyObject *arg,
void *Py_UNUSED(closure))
{
PySSLContext *self = PySSLContext_CAST(op);
FILE *fp;

#if !defined(MS_WINDOWS_DESKTOP) && defined(MS_WINDOWS_APP)
PyErr_SetString(PyExc_NotImplementedError,
"set_keylog_filename: unavailable on UWP build");
return -1;
#else
#if defined(MS_WINDOWS) && defined(Py_DEBUG)
PyErr_SetString(PyExc_NotImplementedError,
"set_keylog_filename: unavailable on Windows debug build");
return -1;
#endif
PySSLContext* self = PySSLContext_CAST(op);
FILE* fp;

/* Reset variables and callback first */
SSL_CTX_set_keylog_callback(self->ctx, NULL);
Expand Down Expand Up @@ -231,4 +235,5 @@ _PySSLContext_set_keylog_filename(PyObject *op, PyObject *arg,
PySSL_END_ALLOW_THREADS(self)
SSL_CTX_set_keylog_callback(self->ctx, _PySSL_keylog_callback);
return 0;
#endif
}
Loading