complain if the codec doesn't return unicode
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 46cf9b2..249bb96 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -400,6 +400,12 @@
buf = PyObject_CallObject(tok->decoding_readline, NULL);
if (buf == NULL)
return error_ret(tok);
+ if (!PyUnicode_Check(buf)) {
+ Py_DECREF(buf);
+ PyErr_SetString(PyExc_SyntaxError,
+ "codec did not return a unicode object");
+ return error_ret(tok);
+ }
} else {
tok->decoding_buffer = NULL;
if (PyString_CheckExact(buf))