diff Python/import.c @ 35678:f0951fdaed37 legacy-trunk

Fix SF bug #976608, Unhelpful error message when mtime of a module is -1 Will backport.
author Neal Norwitz <nnorwitz@gmail.com>
date Mon, 03 Oct 2005 04:48:15 +0000
parents 724bbd489ad4
children 1c4d192f1568
line wrap: on
line diff
--- a/Python/import.c	Mon Oct 03 03:57:09 2005 +0000
+++ b/Python/import.c	Mon Oct 03 04:48:15 2005 +0000
@@ -868,8 +868,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,