Skip to content

Commit fb266e1

Browse files
Include the encoding name in the error message.
1 parent ae909b2 commit fb266e1

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

Modules/pyexpat.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,8 +1482,9 @@ PyUnknownEncodingHandler(void *encodingHandlerData,
14821482
if (is_multibyte != 0) { // true or error
14831483
Py_DECREF(codec);
14841484
if (is_multibyte > 0) { // true
1485-
PyErr_SetString(PyExc_ValueError,
1486-
"multi-byte encodings are not supported");
1485+
PyErr_Format(PyExc_ValueError,
1486+
"multi-byte encodings are not supported: '%s'",
1487+
name);
14871488
}
14881489
return XML_STATUS_ERROR;
14891490
}
@@ -1499,8 +1500,9 @@ PyUnknownEncodingHandler(void *encodingHandlerData,
14991500

15001501
if (PyUnicode_GET_LENGTH(u) != 256) {
15011502
Py_DECREF(u);
1502-
PyErr_SetString(PyExc_ValueError,
1503-
"multi-byte encodings are not supported");
1503+
PyErr_Format(PyExc_ValueError,
1504+
"multi-byte encodings are not supported: '%s'",
1505+
name);
15041506
return XML_STATUS_ERROR;
15051507
}
15061508

0 commit comments

Comments
 (0)