|
@@ -2307,6 +2307,9 @@ static int load_entitydefs(void) |
|
|
{ |
|
|
{ |
|
|
PyObject *tempmod, *defmap, *deflist; |
|
|
PyObject *tempmod, *defmap, *deflist; |
|
|
unsigned numdefs, i; |
|
|
unsigned numdefs, i; |
|
|
|
|
|
#ifdef IS_PY3K |
|
|
|
|
|
PyObject *string; |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
#ifdef IS_PY3K |
|
|
#ifdef IS_PY3K |
|
|
tempmod = PyImport_ImportModule("html.entities"); |
|
|
tempmod = PyImport_ImportModule("html.entities"); |
|
@@ -2328,7 +2331,15 @@ static int load_entitydefs(void) |
|
|
if (!entitydefs) |
|
|
if (!entitydefs) |
|
|
return -1; |
|
|
return -1; |
|
|
for (i = 0; i < numdefs; i++) { |
|
|
for (i = 0; i < numdefs; i++) { |
|
|
|
|
|
#ifdef IS_PY3K |
|
|
|
|
|
string = PyUnicode_AsASCIIString(PyList_GET_ITEM(deflist, i)); |
|
|
|
|
|
if (!string) |
|
|
|
|
|
return -1; |
|
|
|
|
|
entitydefs[i] = PyBytes_AsString(string); |
|
|
|
|
|
Py_DECREF(string); |
|
|
|
|
|
#else |
|
|
entitydefs[i] = PyBytes_AsString(PyList_GET_ITEM(deflist, i)); |
|
|
entitydefs[i] = PyBytes_AsString(PyList_GET_ITEM(deflist, i)); |
|
|
|
|
|
#endif |
|
|
if (!entitydefs[i]) |
|
|
if (!entitydefs[i]) |
|
|
return -1; |
|
|
return -1; |
|
|
} |
|
|
} |
|
|