File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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" );
You can’t perform that action at this time.
0 commit comments