- Fix segfault with invalid coding.
- SF Bug #772896, unknown encoding results in MemoryError, which is not helpful
I will only backport the segfault fix. I'll let Anthony decide if he wants
the other changes backported. I will do the backport if asked.
diff --git a/Parser/parsetok.c b/Parser/parsetok.c
index 1fa9739..1d25437 100644
--- a/Parser/parsetok.c
+++ b/Parser/parsetok.c
@@ -42,7 +42,7 @@
initerr(err_ret, filename);
if ((tok = PyTokenizer_FromString(s)) == NULL) {
- err_ret->error = E_NOMEM;
+ err_ret->error = PyErr_Occurred() ? E_DECODE : E_NOMEM;
return NULL;
}