Show More
@@ -391,51 +391,51 b' error_value:' | |||
|
391 | 391 | |
|
392 | 392 | static PyObject *statfiles(PyObject *self, PyObject *args) |
|
393 | 393 | { |
|
394 |
|
|
|
395 |
|
|
|
394 | PyObject *names, *stats; | |
|
395 | Py_ssize_t i, count; | |
|
396 | 396 | |
|
397 |
|
|
|
398 | return NULL; | |
|
397 | if (!PyArg_ParseTuple(args, "O:statfiles", &names)) | |
|
398 | return NULL; | |
|
399 | 399 | |
|
400 |
|
|
|
401 |
|
|
|
402 |
|
|
|
403 | return NULL; | |
|
404 | } | |
|
400 | count = PySequence_Length(names); | |
|
401 | if (count == -1) { | |
|
402 | PyErr_SetString(PyExc_TypeError, "not a sequence"); | |
|
403 | return NULL; | |
|
404 | } | |
|
405 | 405 | |
|
406 |
|
|
|
407 |
|
|
|
408 | return NULL; | |
|
406 | stats = PyList_New(count); | |
|
407 | if (stats == NULL) | |
|
408 | return NULL; | |
|
409 | 409 | |
|
410 |
|
|
|
411 |
|
|
|
412 |
|
|
|
413 |
|
|
|
414 | char *path; | |
|
410 | for (i = 0; i < count; i++) { | |
|
411 | PyObject *stat; | |
|
412 | struct stat st; | |
|
413 | int ret, kind; | |
|
414 | char *path; | |
|
415 | 415 | |
|
416 |
|
|
|
417 |
|
|
|
418 |
|
|
|
419 | goto bail; | |
|
420 | } | |
|
421 |
|
|
|
422 |
|
|
|
423 |
|
|
|
424 |
|
|
|
425 | if (stat == NULL) | |
|
426 | goto bail; | |
|
427 |
|
|
|
428 | } else { | |
|
429 | Py_INCREF(Py_None); | |
|
430 |
|
|
|
431 | } | |
|
432 | } | |
|
416 | path = PyString_AsString(PySequence_GetItem(names, i)); | |
|
417 | if (path == NULL) { | |
|
418 | PyErr_SetString(PyExc_TypeError, "not a string"); | |
|
419 | goto bail; | |
|
420 | } | |
|
421 | ret = lstat(path, &st); | |
|
422 | kind = st.st_mode & S_IFMT; | |
|
423 | if (ret != -1 && (kind == S_IFREG || kind == S_IFLNK)) { | |
|
424 | stat = makestat(&st); | |
|
425 | if (stat == NULL) | |
|
426 | goto bail; | |
|
427 | PyList_SET_ITEM(stats, i, stat); | |
|
428 | } else { | |
|
429 | Py_INCREF(Py_None); | |
|
430 | PyList_SET_ITEM(stats, i, Py_None); | |
|
431 | } | |
|
432 | } | |
|
433 | 433 | |
|
434 |
|
|
|
434 | return stats; | |
|
435 | 435 | |
|
436 | 436 | bail: |
|
437 |
|
|
|
438 |
|
|
|
437 | Py_DECREF(stats); | |
|
438 | return NULL; | |
|
439 | 439 | } |
|
440 | 440 | |
|
441 | 441 | #endif /* ndef _WIN32 */ |
General Comments 0
You need to be logged in to leave comments.
Login now