Skip to content

Commit 2e2df1e

Browse files
Uncomment temporary commented out code.
1 parent cef74d0 commit 2e2df1e

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

Modules/pyexpat.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,25 +1470,25 @@ PyUnknownEncodingHandler(void *encodingHandlerData,
14701470
if (codec == NULL) {
14711471
return XML_STATUS_ERROR;
14721472
}
1473-
// if (!PyTuple_CheckExact(codec)) {
1474-
// PyObject *attr;
1475-
// if (PyObject_GetOptionalAttrString(codec, "_is_single_byte", &attr) < 0) {
1476-
// Py_DECREF(codec);
1477-
// return XML_STATUS_ERROR;
1478-
// }
1479-
// if (attr != NULL) {
1480-
// int is_single_byte = PyObject_IsTrue(attr);
1481-
// Py_DECREF(attr);
1482-
// if (is_single_byte <= 0) {
1483-
// Py_DECREF(codec);
1484-
// if (is_single_byte == 0) {
1485-
// PyErr_SetString(PyExc_ValueError,
1486-
// "multi-byte encodings are not supported");
1487-
// }
1488-
// return XML_STATUS_ERROR;
1489-
// }
1490-
// }
1491-
// }
1473+
if (!PyTuple_CheckExact(codec)) {
1474+
PyObject *attr;
1475+
if (PyObject_GetOptionalAttrString(codec, "_is_single_byte", &attr) < 0) {
1476+
Py_DECREF(codec);
1477+
return XML_STATUS_ERROR;
1478+
}
1479+
if (attr != NULL) {
1480+
int is_single_byte = PyObject_IsTrue(attr);
1481+
Py_DECREF(attr);
1482+
if (is_single_byte <= 0) {
1483+
Py_DECREF(codec);
1484+
if (is_single_byte == 0) {
1485+
PyErr_SetString(PyExc_ValueError,
1486+
"multi-byte encodings are not supported");
1487+
}
1488+
return XML_STATUS_ERROR;
1489+
}
1490+
}
1491+
}
14921492
Py_DECREF(codec);
14931493

14941494
u = PyUnicode_Decode((const char*) template_buffer, 256, name, "replace");

0 commit comments

Comments
 (0)