Fix reference loss on Py_None when None is encountered in sys.modules.
diff --git a/Python/import.c b/Python/import.c
index 1b93b7c..bd0d18a 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -2827,6 +2827,7 @@
         if (msg != NULL) {
             PyErr_SetFromImportErrorWithName(msg, abs_name);
         }
+        mod = NULL;
         goto error_with_unlock;
     }
     else if (mod != NULL) {