/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/readdir.c

  • Committer: Robert Collins
  • Date: 2008-08-20 02:07:36 UTC
  • mfrom: (3640 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3682.
  • Revision ID: robertc@robertcollins.net-20080820020736-g2xe4921zzxtymle
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Generated by Pyrex 0.9.3.1 on Sat Jun 10 02:07:45 2006 */
 
1
/* Generated by Pyrex 0.9.6.4 on Wed Aug 20 12:04:52 2008 */
2
2
 
 
3
#define PY_SSIZE_T_CLEAN
3
4
#include "Python.h"
4
5
#include "structmember.h"
5
6
#ifndef PY_LONG_LONG
6
7
  #define PY_LONG_LONG LONG_LONG
7
8
#endif
 
9
#if PY_VERSION_HEX < 0x02050000
 
10
  typedef int Py_ssize_t;
 
11
  #define PY_SSIZE_T_MAX INT_MAX
 
12
  #define PY_SSIZE_T_MIN INT_MIN
 
13
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
 
14
  #define PyInt_AsSsize_t(o)    PyInt_AsLong(o)
 
15
#endif
 
16
#ifndef WIN32
 
17
  #ifndef __stdcall
 
18
    #define __stdcall
 
19
  #endif
 
20
  #ifndef __cdecl
 
21
    #define __cdecl
 
22
  #endif
 
23
#endif
 
24
#ifdef __cplusplus
 
25
#define __PYX_EXTERN_C extern "C"
 
26
#else
 
27
#define __PYX_EXTERN_C extern
 
28
#endif
 
29
#include <math.h>
8
30
#include "errno.h"
9
31
#include "sys/types.h"
10
32
#include "dirent.h"
13
35
 
14
36
typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
15
37
typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
16
 
static PyObject *__Pyx_UnpackItem(PyObject *, int); /*proto*/
17
 
static int __Pyx_EndUnpack(PyObject *, int); /*proto*/
18
 
static int __Pyx_PrintItem(PyObject *); /*proto*/
19
 
static int __Pyx_PrintNewline(void); /*proto*/
20
 
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
21
 
static void __Pyx_ReRaise(void); /*proto*/
22
 
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
23
 
static PyObject *__Pyx_GetExcValue(void); /*proto*/
24
 
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/
25
 
static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
26
 
static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], int nargs, PyObject **args2, PyObject **kwds2); /*proto*/
27
 
static void __Pyx_WriteUnraisable(char *name); /*proto*/
28
 
static void __Pyx_AddTraceback(char *funcname); /*proto*/
29
 
static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size);  /*proto*/
30
 
static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
31
 
static int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/
32
 
static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/
33
 
static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
34
 
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
35
 
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
36
38
 
37
39
static PyObject *__pyx_m;
38
40
static PyObject *__pyx_b;
39
41
static int __pyx_lineno;
40
42
static char *__pyx_filename;
41
 
staticforward char **__pyx_f;
 
43
static char **__pyx_f;
42
44
 
43
45
static char __pyx_mdoc[] = "Wrapper for readdir which grabs file type from d_type.";
44
46
 
 
47
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
 
48
 
 
49
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
 
50
 
 
51
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 
52
 
 
53
static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
 
54
 
 
55
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
 
56
 
 
57
static void __Pyx_AddTraceback(char *funcname); /*proto*/
 
58
 
45
59
/* Declarations from readdir */
46
60
 
47
61
 
 
62
 
48
63
/* Implementation of readdir */
49
64
 
50
 
static char (__pyx_k11[]) = ".";
 
65
static char __pyx_k11[] = ".";
51
66
 
52
67
static PyObject *__pyx_n_os;
53
68
static PyObject *__pyx_n_sys;
54
69
static PyObject *__pyx_n__directory;
 
70
static PyObject *__pyx_n_directory;
55
71
static PyObject *__pyx_n__chardev;
 
72
static PyObject *__pyx_n_chardev;
56
73
static PyObject *__pyx_n__block;
 
74
static PyObject *__pyx_n_block;
57
75
static PyObject *__pyx_n__file;
 
76
static PyObject *__pyx_n_file;
58
77
static PyObject *__pyx_n__fifo;
 
78
static PyObject *__pyx_n_fifo;
59
79
static PyObject *__pyx_n__symlink;
 
80
static PyObject *__pyx_n_symlink;
60
81
static PyObject *__pyx_n__socket;
 
82
static PyObject *__pyx_n_socket;
61
83
static PyObject *__pyx_n__unknown;
62
 
static PyObject *__pyx_n_dot;
63
 
static PyObject *__pyx_n_read_dir;
64
 
static PyObject *__pyx_n_directory;
65
 
static PyObject *__pyx_n_chardev;
66
 
static PyObject *__pyx_n_block;
67
 
static PyObject *__pyx_n_file;
68
 
static PyObject *__pyx_n_fifo;
69
 
static PyObject *__pyx_n_symlink;
70
 
static PyObject *__pyx_n_socket;
71
84
static PyObject *__pyx_n_unknown;
72
85
static PyObject *__pyx_n_ord;
 
86
static PyObject *__pyx_n_dot;
73
87
 
74
88
static PyObject *__pyx_k11p;
75
89
 
 
90
static PyObject *__pyx_n_OSError;
76
91
static PyObject *__pyx_n_append;
77
 
static PyObject *__pyx_n_OSError;
 
92
 
78
93
 
79
94
static PyObject *__pyx_f_7readdir_read_dir(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
80
95
static char __pyx_doc_7readdir_read_dir[] = "Like os.listdir, this reads a directories contents.\n\n    :param path: the directory to list.\n    :return: a list of (basename, kind) tuples.\n    ";
81
96
static PyObject *__pyx_f_7readdir_read_dir(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
82
97
  PyObject *__pyx_v_path = 0;
83
 
  DIR (*__pyx_v_the_dir);
84
 
  dirent (*__pyx_v_entry);
85
 
  char (*__pyx_v_name);
 
98
  DIR *__pyx_v_the_dir;
 
99
  dirent *__pyx_v_entry;
 
100
  dirent __pyx_v_sentinel;
 
101
  char *__pyx_v_name;
86
102
  PyObject *__pyx_v_result;
87
103
  PyObject *__pyx_v_type;
88
104
  PyObject *__pyx_r;
89
 
  char (*__pyx_1);
90
 
  DIR (*__pyx_2);
 
105
  char *__pyx_1;
 
106
  int __pyx_2;
91
107
  PyObject *__pyx_3 = 0;
92
 
  int __pyx_4;
 
108
  PyObject *__pyx_4 = 0;
93
109
  PyObject *__pyx_5 = 0;
94
 
  int __pyx_6;
95
 
  PyObject *__pyx_7 = 0;
96
 
  PyObject *__pyx_8 = 0;
 
110
  PyObject *__pyx_6 = 0;
 
111
  int __pyx_7;
97
112
  static char *__pyx_argnames[] = {"path",0};
98
113
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_path)) return 0;
99
114
  Py_INCREF(__pyx_v_path);
100
 
  __pyx_v_result = Py_None; Py_INCREF(__pyx_v_result);
101
 
  __pyx_v_type = Py_None; Py_INCREF(__pyx_v_type);
102
 
 
103
 
  /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":81 */
104
 
  __pyx_1 = PyString_AsString(__pyx_v_path); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
105
 
  __pyx_2 = opendir(__pyx_1); if (__pyx_2 == 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; goto __pyx_L1;}
106
 
  __pyx_v_the_dir = __pyx_2;
 
115
  __pyx_v_result = Py_None; Py_INCREF(Py_None);
 
116
  __pyx_v_type = Py_None; Py_INCREF(Py_None);
107
117
 
108
118
  /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":82 */
109
 
  __pyx_3 = PyList_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
110
 
  Py_DECREF(__pyx_v_result);
111
 
  __pyx_v_result = __pyx_3;
112
 
  __pyx_3 = 0;
 
119
  __pyx_1 = PyString_AsString(__pyx_v_path); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
 
120
  __pyx_v_the_dir = opendir(__pyx_1);
113
121
 
114
122
  /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":83 */
 
123
  __pyx_2 = (NULL == __pyx_v_the_dir);
 
124
  if (__pyx_2) {
 
125
    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
 
126
    __pyx_4 = PyInt_FromLong(errno); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
 
127
    __pyx_5 = PyString_FromString(strerror(errno)); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
 
128
    __pyx_6 = PyTuple_New(2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
 
129
    PyTuple_SET_ITEM(__pyx_6, 0, __pyx_4);
 
130
    PyTuple_SET_ITEM(__pyx_6, 1, __pyx_5);
 
131
    __pyx_4 = 0;
 
132
    __pyx_5 = 0;
 
133
    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_6); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
 
134
    Py_DECREF(__pyx_3); __pyx_3 = 0;
 
135
    Py_DECREF(__pyx_6); __pyx_6 = 0;
 
136
    __Pyx_Raise(__pyx_4, 0, 0);
 
137
    Py_DECREF(__pyx_4); __pyx_4 = 0;
 
138
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; goto __pyx_L1;}
 
139
    goto __pyx_L2;
 
140
  }
 
141
  __pyx_L2:;
 
142
 
 
143
  /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":85 */
 
144
  __pyx_5 = PyList_New(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; goto __pyx_L1;}
 
145
  Py_DECREF(__pyx_v_result);
 
146
  __pyx_v_result = __pyx_5;
 
147
  __pyx_5 = 0;
 
148
 
 
149
  /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":86 */
115
150
  /*try:*/ {
116
151
 
117
 
    /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":84 */
118
 
    __pyx_v_entry = readdir(__pyx_v_the_dir);
 
152
    /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":87 */
 
153
    __pyx_v_entry = (&__pyx_v_sentinel);
119
154
 
120
 
    /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":85 */
 
155
    /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":88 */
121
156
    while (1) {
122
 
      __pyx_L5:;
123
 
      __pyx_4 = (__pyx_v_entry != 0);
124
 
      if (!__pyx_4) break;
125
 
 
126
 
      /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":86 */
 
157
      __pyx_2 = (__pyx_v_entry != NULL);
 
158
      if (!__pyx_2) break;
 
159
 
 
160
      /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":89 */
 
161
      __pyx_v_entry = readdir(__pyx_v_the_dir);
 
162
 
 
163
      /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":90 */
 
164
      __pyx_2 = (__pyx_v_entry == NULL);
 
165
      if (__pyx_2) {
 
166
        __pyx_2 = (errno == EAGAIN);
 
167
        if (__pyx_2) {
 
168
          goto __pyx_L6;
 
169
          goto __pyx_L9;
 
170
        }
 
171
        __pyx_2 = (errno != ENOTDIR);
 
172
        if (__pyx_2) {
 
173
          __pyx_2 = (errno != ENOENT);
 
174
          if (__pyx_2) {
 
175
            __pyx_2 = (errno != 0);
 
176
          }
 
177
        }
 
178
        if (__pyx_2) {
 
179
          __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L4;}
 
180
          __pyx_6 = PyInt_FromLong(errno); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L4;}
 
181
          __pyx_4 = PyString_FromString(strerror(errno)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L4;}
 
182
          __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L4;}
 
183
          PyTuple_SET_ITEM(__pyx_5, 0, __pyx_6);
 
184
          PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
 
185
          __pyx_6 = 0;
 
186
          __pyx_4 = 0;
 
187
          __pyx_6 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L4;}
 
188
          Py_DECREF(__pyx_3); __pyx_3 = 0;
 
189
          Py_DECREF(__pyx_5); __pyx_5 = 0;
 
190
          __Pyx_Raise(__pyx_6, 0, 0);
 
191
          Py_DECREF(__pyx_6); __pyx_6 = 0;
 
192
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L4;}
 
193
          goto __pyx_L9;
 
194
        }
 
195
        /*else*/ {
 
196
          goto __pyx_L6;
 
197
        }
 
198
        __pyx_L9:;
 
199
        goto __pyx_L8;
 
200
      }
 
201
      __pyx_L8:;
 
202
 
 
203
      /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":104 */
127
204
      __pyx_v_name = __pyx_v_entry->d_name;
128
205
 
129
 
      /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":87 */
130
 
      __pyx_3 = PyInt_FromLong((__pyx_v_name[0])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; goto __pyx_L3;}
131
 
      __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_dot); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; goto __pyx_L3;}
132
 
      if (PyObject_Cmp(__pyx_3, __pyx_5, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; goto __pyx_L3;}
133
 
      __pyx_4 = __pyx_4 == 0;
 
206
      /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":105 */
 
207
      __pyx_4 = PyInt_FromLong((__pyx_v_name[0])); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L4;}
 
208
      __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_dot); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L4;}
 
209
      if (PyObject_Cmp(__pyx_4, __pyx_3, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L4;}
 
210
      __pyx_2 = __pyx_2 == 0;
 
211
      Py_DECREF(__pyx_4); __pyx_4 = 0;
134
212
      Py_DECREF(__pyx_3); __pyx_3 = 0;
135
 
      Py_DECREF(__pyx_5); __pyx_5 = 0;
136
 
      if (__pyx_4) {
137
 
        __pyx_4 = ((__pyx_v_name[1]) == 0);
138
 
        if (!__pyx_4) {
139
 
          __pyx_3 = PyInt_FromLong((__pyx_v_name[1])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L3;}
140
 
          __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n_dot); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L3;}
141
 
          if (PyObject_Cmp(__pyx_3, __pyx_5, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L3;}
142
 
          __pyx_4 = __pyx_4 == 0;
143
 
          Py_DECREF(__pyx_3); __pyx_3 = 0;
 
213
      if (__pyx_2) {
 
214
        __pyx_2 = ((__pyx_v_name[1]) == 0);
 
215
        if (!__pyx_2) {
 
216
          __pyx_5 = PyInt_FromLong((__pyx_v_name[1])); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L4;}
 
217
          __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_n_dot); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L4;}
 
218
          if (PyObject_Cmp(__pyx_5, __pyx_6, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L4;}
 
219
          __pyx_2 = __pyx_2 == 0;
144
220
          Py_DECREF(__pyx_5); __pyx_5 = 0;
145
 
          if (__pyx_4) {
146
 
            __pyx_4 = ((__pyx_v_name[2]) == 0);
 
221
          Py_DECREF(__pyx_6); __pyx_6 = 0;
 
222
          if (__pyx_2) {
 
223
            __pyx_2 = ((__pyx_v_name[2]) == 0);
147
224
          }
148
225
        }
149
226
      }
150
 
      __pyx_6 = (!__pyx_4);
151
 
      if (__pyx_6) {
152
 
 
153
 
        /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":91 */
154
 
        __pyx_4 = (__pyx_v_entry->d_type == DT_UNKNOWN);
155
 
        if (__pyx_4) {
156
 
 
157
 
          /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":92 */
158
 
          __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__unknown); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L3;}
159
 
          Py_DECREF(__pyx_v_type);
160
 
          __pyx_v_type = __pyx_3;
161
 
          __pyx_3 = 0;
162
 
          goto __pyx_L8;
163
 
        }
164
 
        __pyx_6 = (__pyx_v_entry->d_type == DT_REG);
165
 
        if (__pyx_6) {
166
 
 
167
 
          /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":94 */
168
 
          __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__file); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; goto __pyx_L3;}
169
 
          Py_DECREF(__pyx_v_type);
170
 
          __pyx_v_type = __pyx_5;
171
 
          __pyx_5 = 0;
172
 
          goto __pyx_L8;
173
 
        }
174
 
        __pyx_4 = (__pyx_v_entry->d_type == DT_DIR);
175
 
        if (__pyx_4) {
176
 
 
177
 
          /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":96 */
178
 
          __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__directory); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; goto __pyx_L3;}
179
 
          Py_DECREF(__pyx_v_type);
180
 
          __pyx_v_type = __pyx_3;
181
 
          __pyx_3 = 0;
182
 
          goto __pyx_L8;
183
 
        }
184
 
        __pyx_6 = (__pyx_v_entry->d_type == DT_FIFO);
185
 
        if (__pyx_6) {
186
 
 
187
 
          /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":98 */
188
 
          __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__fifo); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L3;}
189
 
          Py_DECREF(__pyx_v_type);
190
 
          __pyx_v_type = __pyx_5;
191
 
          __pyx_5 = 0;
192
 
          goto __pyx_L8;
193
 
        }
194
 
        __pyx_4 = (__pyx_v_entry->d_type == DT_SOCK);
195
 
        if (__pyx_4) {
196
 
 
197
 
          /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":100 */
198
 
          __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__socket); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; goto __pyx_L3;}
199
 
          Py_DECREF(__pyx_v_type);
200
 
          __pyx_v_type = __pyx_3;
201
 
          __pyx_3 = 0;
202
 
          goto __pyx_L8;
203
 
        }
204
 
        __pyx_6 = (__pyx_v_entry->d_type == DT_CHR);
205
 
        if (__pyx_6) {
206
 
 
207
 
          /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":102 */
208
 
          __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__chardev); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; goto __pyx_L3;}
209
 
          Py_DECREF(__pyx_v_type);
210
 
          __pyx_v_type = __pyx_5;
211
 
          __pyx_5 = 0;
212
 
          goto __pyx_L8;
213
 
        }
214
 
        __pyx_4 = (__pyx_v_entry->d_type == DT_BLK);
215
 
        if (__pyx_4) {
216
 
 
217
 
          /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":104 */
218
 
          __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__block); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L3;}
219
 
          Py_DECREF(__pyx_v_type);
220
 
          __pyx_v_type = __pyx_3;
221
 
          __pyx_3 = 0;
222
 
          goto __pyx_L8;
 
227
      __pyx_7 = (!__pyx_2);
 
228
      if (__pyx_7) {
 
229
 
 
230
        /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":109 */
 
231
        __pyx_2 = (__pyx_v_entry->d_type == DT_UNKNOWN);
 
232
        if (__pyx_2) {
 
233
          __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__unknown); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L4;}
 
234
          Py_DECREF(__pyx_v_type);
 
235
          __pyx_v_type = __pyx_4;
 
236
          __pyx_4 = 0;
 
237
          goto __pyx_L11;
 
238
        }
 
239
        __pyx_7 = (__pyx_v_entry->d_type == DT_REG);
 
240
        if (__pyx_7) {
 
241
          __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__file); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L4;}
 
242
          Py_DECREF(__pyx_v_type);
 
243
          __pyx_v_type = __pyx_3;
 
244
          __pyx_3 = 0;
 
245
          goto __pyx_L11;
 
246
        }
 
247
        __pyx_2 = (__pyx_v_entry->d_type == DT_DIR);
 
248
        if (__pyx_2) {
 
249
          __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__directory); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L4;}
 
250
          Py_DECREF(__pyx_v_type);
 
251
          __pyx_v_type = __pyx_5;
 
252
          __pyx_5 = 0;
 
253
          goto __pyx_L11;
 
254
        }
 
255
        __pyx_7 = (__pyx_v_entry->d_type == DT_FIFO);
 
256
        if (__pyx_7) {
 
257
          __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_n__fifo); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; goto __pyx_L4;}
 
258
          Py_DECREF(__pyx_v_type);
 
259
          __pyx_v_type = __pyx_6;
 
260
          __pyx_6 = 0;
 
261
          goto __pyx_L11;
 
262
        }
 
263
        __pyx_2 = (__pyx_v_entry->d_type == DT_SOCK);
 
264
        if (__pyx_2) {
 
265
          __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__socket); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; goto __pyx_L4;}
 
266
          Py_DECREF(__pyx_v_type);
 
267
          __pyx_v_type = __pyx_4;
 
268
          __pyx_4 = 0;
 
269
          goto __pyx_L11;
 
270
        }
 
271
        __pyx_7 = (__pyx_v_entry->d_type == DT_CHR);
 
272
        if (__pyx_7) {
 
273
          __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__chardev); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L4;}
 
274
          Py_DECREF(__pyx_v_type);
 
275
          __pyx_v_type = __pyx_3;
 
276
          __pyx_3 = 0;
 
277
          goto __pyx_L11;
 
278
        }
 
279
        __pyx_2 = (__pyx_v_entry->d_type == DT_BLK);
 
280
        if (__pyx_2) {
 
281
          __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__block); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L4;}
 
282
          Py_DECREF(__pyx_v_type);
 
283
          __pyx_v_type = __pyx_5;
 
284
          __pyx_5 = 0;
 
285
          goto __pyx_L11;
223
286
        }
224
287
        /*else*/ {
225
 
 
226
 
          /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":106 */
227
 
          __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__unknown); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L3;}
 
288
          __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_n__unknown); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; goto __pyx_L4;}
228
289
          Py_DECREF(__pyx_v_type);
229
 
          __pyx_v_type = __pyx_5;
230
 
          __pyx_5 = 0;
 
290
          __pyx_v_type = __pyx_6;
 
291
          __pyx_6 = 0;
231
292
        }
232
 
        __pyx_L8:;
 
293
        __pyx_L11:;
233
294
 
234
 
        /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":107 */
235
 
        __pyx_3 = PyObject_GetAttr(__pyx_v_result, __pyx_n_append); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L3;}
236
 
        __pyx_5 = PyString_FromString(__pyx_v_entry->d_name); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L3;}
237
 
        __pyx_7 = PyTuple_New(2); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L3;}
238
 
        PyTuple_SET_ITEM(__pyx_7, 0, __pyx_5);
239
 
        Py_INCREF(__pyx_v_type);
240
 
        PyTuple_SET_ITEM(__pyx_7, 1, __pyx_v_type);
 
295
        /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":126 */
 
296
        __pyx_4 = PyObject_GetAttr(__pyx_v_result, __pyx_n_append); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L4;}
 
297
        __pyx_3 = PyString_FromString(__pyx_v_entry->d_name); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L4;}
 
298
        __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L4;}
 
299
        PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
 
300
        Py_INCREF(__pyx_n_unknown);
 
301
        PyTuple_SET_ITEM(__pyx_5, 1, __pyx_n_unknown);
 
302
        __pyx_3 = 0;
 
303
        __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L4;}
 
304
        PyTuple_SET_ITEM(__pyx_6, 0, __pyx_5);
241
305
        __pyx_5 = 0;
242
 
        __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L3;}
243
 
        PyTuple_SET_ITEM(__pyx_5, 0, __pyx_7);
244
 
        __pyx_7 = 0;
245
 
        __pyx_7 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L3;}
 
306
        __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_6); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L4;}
 
307
        Py_DECREF(__pyx_4); __pyx_4 = 0;
 
308
        Py_DECREF(__pyx_6); __pyx_6 = 0;
246
309
        Py_DECREF(__pyx_3); __pyx_3 = 0;
247
 
        Py_DECREF(__pyx_5); __pyx_5 = 0;
248
 
        Py_DECREF(__pyx_7); __pyx_7 = 0;
249
 
        goto __pyx_L7;
250
 
      }
251
 
      __pyx_L7:;
252
 
 
253
 
      /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":108 */
254
 
      __pyx_v_entry = readdir(__pyx_v_the_dir);
255
 
    }
256
 
    __pyx_L6:;
257
 
 
258
 
    /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":109 */
259
 
    __pyx_6 = (__pyx_v_entry == 0);
260
 
    if (__pyx_6) {
261
 
      __pyx_6 = (errno != ENOENT);
262
 
      if (__pyx_6) {
263
 
        __pyx_6 = (errno != 0);
264
 
      }
265
 
    }
266
 
    if (__pyx_6) {
267
 
 
268
 
      /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":110 */
269
 
      __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L3;}
270
 
      __pyx_5 = PyInt_FromLong(errno); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L3;}
271
 
      __pyx_7 = PyString_FromString(strerror(errno)); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L3;}
272
 
      __pyx_8 = PyTuple_New(2); if (!__pyx_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L3;}
273
 
      PyTuple_SET_ITEM(__pyx_8, 0, __pyx_5);
274
 
      PyTuple_SET_ITEM(__pyx_8, 1, __pyx_7);
275
 
      __pyx_5 = 0;
276
 
      __pyx_7 = 0;
277
 
      __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_8); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L3;}
278
 
      Py_DECREF(__pyx_3); __pyx_3 = 0;
279
 
      Py_DECREF(__pyx_8); __pyx_8 = 0;
280
 
      __Pyx_Raise(__pyx_5, 0, 0);
281
 
      Py_DECREF(__pyx_5); __pyx_5 = 0;
282
 
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L3;}
283
 
      goto __pyx_L9;
284
 
    }
285
 
    __pyx_L9:;
 
310
        goto __pyx_L10;
 
311
      }
 
312
      __pyx_L10:;
 
313
      __pyx_L6:;
 
314
    }
286
315
  }
287
316
  /*finally:*/ {
288
317
    int __pyx_why;
289
 
    __pyx_why = 0; goto __pyx_L4;
290
 
    __pyx_L2: __pyx_why = 3; goto __pyx_L4;
291
 
    __pyx_L3: {
 
318
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
 
319
    int __pyx_exc_lineno;
 
320
    __pyx_why = 0; goto __pyx_L5;
 
321
    __pyx_L4: {
292
322
      __pyx_why = 4;
293
 
      Py_XDECREF(__pyx_7); __pyx_7 = 0;
 
323
      Py_XDECREF(__pyx_5); __pyx_5 = 0;
 
324
      Py_XDECREF(__pyx_4); __pyx_4 = 0;
 
325
      Py_XDECREF(__pyx_6); __pyx_6 = 0;
294
326
      Py_XDECREF(__pyx_3); __pyx_3 = 0;
295
 
      Py_XDECREF(__pyx_8); __pyx_8 = 0;
296
 
      Py_XDECREF(__pyx_5); __pyx_5 = 0;
297
 
      PyErr_Fetch(&__pyx_7, &__pyx_3, &__pyx_8);
298
 
      __pyx_4 = __pyx_lineno;
299
 
      goto __pyx_L4;
300
 
    }
301
 
    __pyx_L4:;
302
 
 
303
 
    /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":112 */
304
 
    __pyx_6 = closedir(__pyx_v_the_dir); if (__pyx_6 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L1;}
 
327
      PyErr_Fetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
 
328
      __pyx_exc_lineno = __pyx_lineno;
 
329
      goto __pyx_L5;
 
330
    }
 
331
    __pyx_L5:;
 
332
    __pyx_7 = ((-1) == closedir(__pyx_v_the_dir));
 
333
    if (__pyx_7) {
 
334
      __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_OSError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L12;}
 
335
      __pyx_4 = PyInt_FromLong(errno); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L12;}
 
336
      __pyx_6 = PyString_FromString(strerror(errno)); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L12;}
 
337
      __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L12;}
 
338
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
 
339
      PyTuple_SET_ITEM(__pyx_3, 1, __pyx_6);
 
340
      __pyx_4 = 0;
 
341
      __pyx_6 = 0;
 
342
      __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L12;}
 
343
      Py_DECREF(__pyx_5); __pyx_5 = 0;
 
344
      Py_DECREF(__pyx_3); __pyx_3 = 0;
 
345
      __Pyx_Raise(__pyx_4, 0, 0);
 
346
      Py_DECREF(__pyx_4); __pyx_4 = 0;
 
347
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L12;}
 
348
      goto __pyx_L13;
 
349
    }
 
350
    __pyx_L13:;
 
351
    goto __pyx_L14;
 
352
    __pyx_L12:;
 
353
    if (__pyx_why == 4) {
 
354
      Py_XDECREF(__pyx_exc_type);
 
355
      Py_XDECREF(__pyx_exc_value);
 
356
      Py_XDECREF(__pyx_exc_tb);
 
357
    }
 
358
    goto __pyx_L1;
 
359
    __pyx_L14:;
305
360
    switch (__pyx_why) {
306
 
      case 3: goto __pyx_L0;
307
361
      case 4: {
308
 
        PyErr_Restore(__pyx_7, __pyx_3, __pyx_8);
309
 
        __pyx_lineno = __pyx_4;
310
 
        __pyx_7 = 0;
311
 
        __pyx_3 = 0;
312
 
        __pyx_8 = 0;
 
362
        PyErr_Restore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
 
363
        __pyx_lineno = __pyx_exc_lineno;
 
364
        __pyx_exc_type = 0;
 
365
        __pyx_exc_value = 0;
 
366
        __pyx_exc_tb = 0;
313
367
        goto __pyx_L1;
314
368
      }
315
369
    }
316
370
  }
317
371
 
318
 
  /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":113 */
 
372
  /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":130 */
319
373
  Py_INCREF(__pyx_v_result);
320
374
  __pyx_r = __pyx_v_result;
321
375
  goto __pyx_L0;
322
376
 
323
 
  __pyx_r = Py_None; Py_INCREF(__pyx_r);
 
377
  __pyx_r = Py_None; Py_INCREF(Py_None);
324
378
  goto __pyx_L0;
325
379
  __pyx_L1:;
326
380
  Py_XDECREF(__pyx_3);
 
381
  Py_XDECREF(__pyx_4);
327
382
  Py_XDECREF(__pyx_5);
328
 
  Py_XDECREF(__pyx_7);
329
 
  Py_XDECREF(__pyx_8);
 
383
  Py_XDECREF(__pyx_6);
330
384
  __Pyx_AddTraceback("readdir.read_dir");
331
385
  __pyx_r = 0;
332
386
  __pyx_L0:;
355
409
  {&__pyx_n_file, "file"},
356
410
  {&__pyx_n_ord, "ord"},
357
411
  {&__pyx_n_os, "os"},
358
 
  {&__pyx_n_read_dir, "read_dir"},
359
412
  {&__pyx_n_socket, "socket"},
360
413
  {&__pyx_n_symlink, "symlink"},
361
414
  {&__pyx_n_sys, "sys"},
373
426
  {0, 0, 0, 0}
374
427
};
375
428
 
376
 
DL_EXPORT(void) initreaddir(void); /*proto*/
377
 
DL_EXPORT(void) initreaddir(void) {
 
429
static void __pyx_init_filenames(void); /*proto*/
 
430
 
 
431
PyMODINIT_FUNC initreaddir(void); /*proto*/
 
432
PyMODINIT_FUNC initreaddir(void) {
378
433
  PyObject *__pyx_1 = 0;
379
434
  PyObject *__pyx_2 = 0;
380
435
  PyObject *__pyx_3 = 0;
 
436
  __pyx_init_filenames();
381
437
  __pyx_m = Py_InitModule4("readdir", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION);
382
 
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; goto __pyx_L1;};
 
438
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;};
 
439
  Py_INCREF(__pyx_m);
383
440
  __pyx_b = PyImport_AddModule("__builtin__");
384
 
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; goto __pyx_L1;};
385
 
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; goto __pyx_L1;};
386
 
  if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; goto __pyx_L1;};
387
 
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; goto __pyx_L1;};
 
441
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;};
 
442
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;};
 
443
  if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;};
 
444
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;};
388
445
 
389
 
  /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":22 */
390
 
  __pyx_1 = __Pyx_Import(__pyx_n_os, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; goto __pyx_L1;}
391
 
  if (PyObject_SetAttr(__pyx_m, __pyx_n_os, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; goto __pyx_L1;}
 
446
  /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":20 */
 
447
  __pyx_1 = __Pyx_Import(__pyx_n_os, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;}
 
448
  if (PyObject_SetAttr(__pyx_m, __pyx_n_os, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; goto __pyx_L1;}
392
449
  Py_DECREF(__pyx_1); __pyx_1 = 0;
393
450
 
394
 
  /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":23 */
395
 
  __pyx_1 = __Pyx_Import(__pyx_n_sys, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; goto __pyx_L1;}
396
 
  if (PyObject_SetAttr(__pyx_m, __pyx_n_sys, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; goto __pyx_L1;}
 
451
  /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":21 */
 
452
  __pyx_1 = __Pyx_Import(__pyx_n_sys, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; goto __pyx_L1;}
 
453
  if (PyObject_SetAttr(__pyx_m, __pyx_n_sys, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; goto __pyx_L1;}
397
454
  Py_DECREF(__pyx_1); __pyx_1 = 0;
398
455
 
399
456
  /* "/home/robertc/source/baz/readdir/bzrlib/readdir.pyx":55 */
443
500
static char *__pyx_filenames[] = {
444
501
  "readdir.pyx",
445
502
};
446
 
statichere char **__pyx_f = __pyx_filenames;
447
503
 
448
504
/* Runtime support code */
449
505
 
 
506
static void __pyx_init_filenames(void) {
 
507
  __pyx_f = __pyx_filenames;
 
508
}
 
509
 
450
510
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
451
511
    PyObject *__import__ = 0;
452
512
    PyObject *empty_list = 0;
507
567
        value = Py_None;
508
568
        Py_INCREF(value);
509
569
    }
510
 
    /* Next, repeatedly, replace a tuple exception with its first item */
511
 
    while (PyTuple_Check(type) && PyTuple_Size(type) > 0) {
512
 
        PyObject *tmp = type;
513
 
        type = PyTuple_GET_ITEM(type, 0);
514
 
        Py_INCREF(type);
515
 
        Py_DECREF(tmp);
516
 
    }
517
 
    if (PyString_Check(type))
518
 
        ;
519
 
    else if (PyClass_Check(type))
520
 
        ; /*PyErr_NormalizeException(&type, &value, &tb);*/
521
 
    else if (PyInstance_Check(type)) {
 
570
    #if PY_VERSION_HEX < 0x02050000
 
571
    if (!PyClass_Check(type))
 
572
    #else
 
573
    if (!PyType_Check(type))
 
574
    #endif
 
575
    {
522
576
        /* Raising an instance.  The value should be a dummy. */
523
577
        if (value != Py_None) {
524
578
            PyErr_SetString(PyExc_TypeError,
525
 
              "instance exception may not have a separate value");
 
579
                "instance exception may not have a separate value");
526
580
            goto raise_error;
527
581
        }
528
 
        else {
529
 
            /* Normalize to raise <class>, <instance> */
530
 
            Py_DECREF(value);
531
 
            value = type;
532
 
            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
 
582
        /* Normalize to raise <class>, <instance> */
 
583
        Py_DECREF(value);
 
584
        value = type;
 
585
        #if PY_VERSION_HEX < 0x02050000
 
586
            if (PyInstance_Check(type)) {
 
587
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
 
588
                Py_INCREF(type);
 
589
            }
 
590
            else {
 
591
                PyErr_SetString(PyExc_TypeError,
 
592
                    "raise: exception must be an old-style class or instance");
 
593
                goto raise_error;
 
594
            }
 
595
        #else
 
596
            type = (PyObject*) type->ob_type;
533
597
            Py_INCREF(type);
534
 
        }
535
 
    }
536
 
    else {
537
 
        /* Not something you can raise.  You get an exception
538
 
           anyway, just not what you specified :-) */
539
 
        PyErr_Format(PyExc_TypeError,
540
 
                 "exceptions must be strings, classes, or "
541
 
                 "instances, not %s", type->ob_type->tp_name);
542
 
        goto raise_error;
 
598
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
 
599
                PyErr_SetString(PyExc_TypeError,
 
600
                    "raise: exception class must be a subclass of BaseException");
 
601
                goto raise_error;
 
602
            }
 
603
        #endif
543
604
    }
544
605
    PyErr_Restore(type, value, tb);
545
606
    return;