Add debugging for charset encoding parameter setting.

This commit is contained in:
Bastian Kleineidam 2011-08-14 12:45:08 +02:00
parent 3f7057ce78
commit 689ab9f073
2 changed files with 18 additions and 0 deletions

View file

@ -2408,6 +2408,15 @@ static int parser_setencoding (parser_object* self, PyObject* value, void* closu
Py_DECREF(self->encoding);
Py_INCREF(value);
self->encoding = value;
if (yydebug > 0) {
/* print debug message */
PyObject* repr = PyObject_Repr(value);
if (repr == NULL) {
return -1;
}
fprintf(stderr, "htmlsax: set encoding to %s\n", PyString_AsString(repr));
Py_DECREF(repr);
}
return 0;
}

View file

@ -828,6 +828,15 @@ static int parser_setencoding (parser_object* self, PyObject* value, void* closu
Py_DECREF(self->encoding);
Py_INCREF(value);
self->encoding = value;
if (yydebug > 0) {
/* print debug message */
PyObject* repr = PyObject_Repr(value);
if (repr == NULL) {
return -1;
}
fprintf(stderr, "htmlsax: set encoding to %s\n", PyString_AsString(repr));
Py_DECREF(repr);
}
return 0;
}