summaryrefslogtreecommitdiffstats
path: root/Python/fileutils.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-12-18 19:47:30 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-12-18 19:47:30 (GMT)
commitbd0850b8575730fb1ea587a64e95c818e9504c13 (patch)
tree54fd7553ce6a3465af3422e6056f7fd0b4dadfe6 /Python/fileutils.c
parent7bfe89945b6960bb68e27fd25fea421eee9b1fca (diff)
downloadcpython-bd0850b8575730fb1ea587a64e95c818e9504c13.zip
cpython-bd0850b8575730fb1ea587a64e95c818e9504c13.tar.gz
cpython-bd0850b8575730fb1ea587a64e95c818e9504c13.tar.bz2
import.c now catchs _Py_stat() exceptions
_Py_stat() now returns -2 if an exception was raised.
Diffstat (limited to 'Python/fileutils.c')
-rw-r--r--Python/fileutils.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c
index 0aad220..8c049e0 100644
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -240,8 +240,8 @@ _Py_wstat(const wchar_t* path, struct stat *buf)
/* 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 @@ _Py_stat(PyObject *path, struct stat *statbuf)
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 @@ _Py_stat(PyObject *path, struct stat *statbuf)
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;