Port error handlers from Py_UNICODE indexing to code point indexing.
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index ad618ff..5b5447a 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -1513,6 +1513,11 @@
           return -1;
     }
 
+    if (PyUnicode_READY(err->object) < -1) {
+        err->encoding = NULL;
+        return -1;
+    }
+
     Py_INCREF(err->encoding);
     Py_INCREF(err->object);
     Py_INCREF(err->reason);