Kaydet (Commit) 708e51a6 authored tarafından Neal Norwitz's avatar Neal Norwitz

Fix SF bug #976608, Unhelpful error message when mtime of a module is -1

Will backport.
üst a45770d6
...@@ -12,6 +12,8 @@ What's New in Python 2.5 alpha 1? ...@@ -12,6 +12,8 @@ What's New in Python 2.5 alpha 1?
Core and builtins Core and builtins
----------------- -----------------
- SF Bug #976608: fix SystemError when mtime of an imported file is -1.
- SF Bug #887946: fix segfault when redirecting stdin from a directory. - SF Bug #887946: fix segfault when redirecting stdin from a directory.
Provide a warning when a directory is passed on the command line. Provide a warning when a directory is passed on the command line.
......
...@@ -868,8 +868,12 @@ load_source_module(char *name, char *pathname, FILE *fp) ...@@ -868,8 +868,12 @@ load_source_module(char *name, char *pathname, FILE *fp)
PyObject *m; PyObject *m;
mtime = PyOS_GetLastModificationTime(pathname, fp); 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; return NULL;
}
#if SIZEOF_TIME_T > 4 #if SIZEOF_TIME_T > 4
/* Python's .pyc timestamp handling presumes that the timestamp fits /* Python's .pyc timestamp handling presumes that the timestamp fits
in 4 bytes. This will be fine until sometime in the year 2038, in 4 bytes. This will be fine until sometime in the year 2038,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment