Skip to content

Commit 9296a9c

Browse files
committed
Better grammar and fix for other test using test_dh_params
1 parent dac6cfb commit 9296a9c

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

Lib/test/audit-tests.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,15 @@ def test_open(testfn):
208208
if not fn:
209209
continue
210210
with assertRaises(RuntimeError):
211-
fn(*args)
211+
try:
212+
fn(*args)
213+
except NotImplementedError:
214+
if fn == load_dh_params:
215+
# Not callable in some builds
216+
load_dh_params = None
217+
raise RuntimeError
218+
else:
219+
raise
212220

213221
actual_mode = [(a[0], a[1]) for e, a in hook.seen if e == "open" and a[1]]
214222
actual_flag = [(a[0], a[2]) for e, a in hook.seen if e == "open" and not a[1]]

Lib/test/test_audit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def run_test_in_subprocess(self, *args):
2323
with subprocess.Popen(
2424
[sys.executable, "-X utf8", AUDIT_TESTS_PY, *args],
2525
encoding="utf-8",
26+
errors="backslashreplace",
2627
stdout=subprocess.PIPE,
2728
stderr=subprocess.PIPE,
2829
) as p:

Modules/_ssl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4428,8 +4428,8 @@ _ssl__SSLContext_load_dh_params_impl(PySSLContext *self, PyObject *filepath)
44284428
DH *dh;
44294429

44304430
#if defined(MS_WINDOWS) && defined(_DEBUG)
4431-
PyErr_SetString(PyExc_RuntimeError,
4432-
"unable to load_dh_params on Windows debug build");
4431+
PyErr_SetString(PyExc_NotImplementedError,
4432+
"load_dh_params: unavailable on Windows debug build");
44334433
return NULL;
44344434
#endif
44354435

Modules/_ssl/debughelpers.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ _PySSLContext_set_keylog_filename(PyObject *op, PyObject *arg,
176176
FILE *fp;
177177

178178
#if defined(MS_WINDOWS) && defined(_DEBUG)
179-
PyErr_SetString(PyExc_RuntimeError,
180-
"unable to set_keylog_filename on Windows debug build");
179+
PyErr_SetString(PyExc_NotImplementedError,
180+
"set_keylog_filename: unavailable on Windows debug build");
181181
return -1;
182182
#endif
183183

0 commit comments

Comments
 (0)