Show More
@@ -121,9 +121,9 b' static PyObject *listdir(PyObject *self,' | |||||
121 | int do_stat; |
|
121 | int do_stat; | |
122 | char *path; |
|
122 | char *path; | |
123 | int ret; |
|
123 | int ret; | |
124 |
|
124 | |||
125 | { |
|
125 | { | |
126 |
static char *kwlist[] = { "path", "stat", NULL }; |
|
126 | static char *kwlist[] = { "path", "stat", NULL }; | |
127 | PyObject *statobj = NULL; |
|
127 | PyObject *statobj = NULL; | |
128 |
|
128 | |||
129 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:listdir", kwlist, |
|
129 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s#|O:listdir", kwlist, | |
@@ -132,7 +132,7 b' static PyObject *listdir(PyObject *self,' | |||||
132 |
|
132 | |||
133 | do_stat = statobj && PyObject_IsTrue(statobj); |
|
133 | do_stat = statobj && PyObject_IsTrue(statobj); | |
134 | } |
|
134 | } | |
135 |
|
135 | |||
136 | if ((dir = opendir(path)) == NULL) { |
|
136 | if ((dir = opendir(path)) == NULL) { | |
137 | list = PyErr_SetFromErrnoWithFilename(PyExc_OSError, path); |
|
137 | list = PyErr_SetFromErrnoWithFilename(PyExc_OSError, path); | |
138 | goto bail; |
|
138 | goto bail; | |
@@ -187,9 +187,9 b' static PyObject *listdir(PyObject *self,' | |||||
187 | py_kind = Py_None; |
|
187 | py_kind = Py_None; | |
188 | Py_INCREF(Py_None); |
|
188 | Py_INCREF(Py_None); | |
189 | } |
|
189 | } | |
190 |
|
190 | |||
191 | val = PyTuple_New(do_stat ? 3 : 2); |
|
191 | val = PyTuple_New(do_stat ? 3 : 2); | |
192 |
|
192 | |||
193 | if (name == NULL || py_kind == NULL || val == NULL) { |
|
193 | if (name == NULL || py_kind == NULL || val == NULL) { | |
194 | Py_XDECREF(name); |
|
194 | Py_XDECREF(name); | |
195 | Py_XDECREF(py_kind); |
|
195 | Py_XDECREF(py_kind); | |
@@ -208,7 +208,7 b' static PyObject *listdir(PyObject *self,' | |||||
208 | PyList_Append(list, val); |
|
208 | PyList_Append(list, val); | |
209 | Py_DECREF(val); |
|
209 | Py_DECREF(val); | |
210 | } |
|
210 | } | |
211 |
|
211 | |||
212 | PyList_Sort(list); |
|
212 | PyList_Sort(list); | |
213 |
|
213 | |||
214 | if (do_stat || !all_kinds) { |
|
214 | if (do_stat || !all_kinds) { | |
@@ -226,7 +226,7 b' static PyObject *listdir(PyObject *self,' | |||||
226 | int kind; |
|
226 | int kind; | |
227 |
|
227 | |||
228 | kind = py_kind == Py_None ? -1 : PyInt_AsLong(py_kind); |
|
228 | kind = py_kind == Py_None ? -1 : PyInt_AsLong(py_kind); | |
229 |
|
229 | |||
230 | if (kind != -1 && !do_stat) |
|
230 | if (kind != -1 && !do_stat) | |
231 | continue; |
|
231 | continue; | |
232 |
|
232 | |||
@@ -240,7 +240,7 b' static PyObject *listdir(PyObject *self,' | |||||
240 | if (ctor_args == NULL) |
|
240 | if (ctor_args == NULL) | |
241 | goto bail; |
|
241 | goto bail; | |
242 | } |
|
242 | } | |
243 |
|
243 | |||
244 | st = (struct listdir_stat *) |
|
244 | st = (struct listdir_stat *) | |
245 | PyObject_CallObject((PyObject *) &listdir_stat_type, |
|
245 | PyObject_CallObject((PyObject *) &listdir_stat_type, | |
246 | ctor_args); |
|
246 | ctor_args); |
General Comments 0
You need to be logged in to leave comments.
Login now