Mercurial > cpython-lru_cache-weakref
diff Python/fileutils.c @ 74058:2a140b01d343
import.c now catchs _Py_stat() exceptions
_Py_stat() now returns -2 if an exception was raised.
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Sun, 18 Dec 2011 20:47:30 +0100 |
| parents | 279b0aee0cfb |
| children | a882aa30a713 |
line wrap: on
line diff
--- a/Python/fileutils.c Sun Dec 18 20:22:50 2011 +0100 +++ b/Python/fileutils.c Sun Dec 18 20:47:30 2011 +0100 @@ -240,8 +240,8 @@ /* Call _wstat() on Windows, or encode the path to the filesystem encoding and call stat() otherwise. Only fill st_mode attribute on Windows. - Return 0 on success, -1 on _wstat() / stat() error or (if PyErr_Occurred()) - unicode error. */ + Return 0 on success, -1 on _wstat() / stat() error, -2 if an exception was + raised. */ int _Py_stat(PyObject *path, struct stat *statbuf) @@ -253,7 +253,7 @@ wpath = PyUnicode_AsUnicode(path); if (wpath == NULL) - return -1; + return -2; err = _wstat(wpath, &wstatbuf); if (!err) statbuf->st_mode = wstatbuf.st_mode; @@ -262,7 +262,7 @@ int ret; PyObject *bytes = PyUnicode_EncodeFSDefault(path); if (bytes == NULL) - return -1; + return -2; ret = stat(PyBytes_AS_STRING(bytes), statbuf); Py_DECREF(bytes); return ret;
