Skip to content

Commit d7f1ab1

Browse files
committed
use ImportWarning insteaad of RuntimeWarning
1 parent 3ecba48 commit d7f1ab1

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

Modules/_ssl.c

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6918,11 +6918,15 @@ py_ht_errcode_to_name_create(void) {
69186918
/* sometimes data is duplicated, so we skip it */
69196919
continue;
69206920
}
6921-
PyErr_WarnFormat(PyExc_RuntimeWarning, 2,
6922-
"SSL data contains incompatible entries for "
6923-
"(%d, %d; %p, %ld). Old mnemonic is %S but "
6924-
"new mnemonic is %s.",
6925-
p->library, p->reason, key, code, prev, p->mnemonic);
6921+
int rc = PyErr_WarnFormat(PyExc_ImportWarning, 2,
6922+
"SSL data contains incompatible entries "
6923+
"for (%d, %d; %p, %ld). Old mnemonic is "
6924+
"%S but new mnemonic is %s.",
6925+
p->library, p->reason, key, code,
6926+
prev, p->mnemonic);
6927+
if (rc < 0) {
6928+
goto error;
6929+
}
69266930
continue;
69276931
}
69286932
PyObject *value = PyUnicode_FromString(p->mnemonic);
@@ -6971,11 +6975,14 @@ py_ht_libcode_to_name_create(void) {
69716975
/* sometimes data is duplicated, so we skip it */
69726976
continue;
69736977
}
6974-
PyErr_WarnFormat(PyExc_RuntimeWarning, 2,
6975-
"SSL data contains incompatible entries for "
6976-
"(%p; %d). Old library is %S but new library "
6977-
"is %s.",
6978-
key, p->code, prev, p->library);
6978+
int rc = PyErr_WarnFormat(PyExc_ImportWarning, 2,
6979+
"SSL data contains incompatible entries "
6980+
"for (%p; %d). Old library is %S but new "
6981+
"library is %s.",
6982+
key, p->code, prev, p->library);
6983+
if (rc < 0) {
6984+
goto error;
6985+
}
69796986
continue;
69806987
}
69816988
PyObject *value = PyUnicode_FromString(p->library);

0 commit comments

Comments
 (0)