diff Python/import.c @ 35679:172fcd9c1952 2.4

Backport: Fix SF bug #976608, Unhelpful error message when mtime of a module is -1
author Neal Norwitz <nnorwitz@gmail.com>
date Mon, 03 Oct 2005 04:50:55 +0000
parents 57f630a9de26
children 6fb46e87d5f9
line wrap: on
line diff
--- a/Python/import.c	Mon Oct 03 01:03:46 2005 +0000
+++ b/Python/import.c	Mon Oct 03 04:50:55 2005 +0000
@@ -867,8 +867,12 @@
 	PyObject *m;
 
 	mtime = PyOS_GetLastModificationTime(pathname, fp);
-	if (mtime == (time_t)(-1))
+	if (mtime == (time_t)(-1)) {
+		PyErr_Format(PyExc_RuntimeError,
+			     "unable to get modification time from '%s'",
+			     pathname);
 		return NULL;
+	}
 #if SIZEOF_TIME_T > 4
 	/* Python's .pyc timestamp handling presumes that the timestamp fits
 	   in 4 bytes. This will be fine until sometime in the year 2038,