#3773: Check for errors around the use of PyTokenizer_FindEncoding().

reviewed by Brett Cannon.
diff --git a/Python/import.c b/Python/import.c
index d87d751..9c077fe 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -2830,6 +2830,8 @@
 			   memory. */
 			found_encoding = PyTokenizer_FindEncoding(fd);
 			lseek(fd, 0, 0); /* Reset position */
+			if (found_encoding == NULL && PyErr_Occurred())
+				return NULL;
 			encoding = (found_encoding != NULL) ? found_encoding :
 				   (char*)PyUnicode_GetDefaultEncoding();
 		}