Cython has moved to github.
pyrex
view Tests/9/kwonlyargs.c @ 86:da6e97bb7e6d
Multiple compilation fixed
| author | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| date | Sat May 24 15:50:12 2008 +1200 (4 years ago) |
| parents | 12072e0e4fd5 |
| children | 94d46b3c5354 |
line source
1 /* Generated by Pyrex */
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #include "structmember.h"
6 #ifndef PY_LONG_LONG
7 #define PY_LONG_LONG LONG_LONG
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>
32 typedef struct {PyObject **p; int i; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
34 static PyObject *__pyx_m;
35 static PyObject *__pyx_b;
36 static int __pyx_lineno;
37 static char *__pyx_filename;
38 static char **__pyx_f;
40 static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], Py_ssize_t nargs, PyObject **args2, PyObject **kwds2, char rqd_kwds[]); /*proto*/
42 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
44 static void __Pyx_AddTraceback(char *funcname); /*proto*/
46 /* Declarations from kwonlyargs */
49 /* Declarations from implementation of kwonlyargs */
55 static __Pyx_StringTabEntry __pyx_string_tab[] = {
56 {0, 0, 0, 0}
57 };
59 static PyObject *__pyx_d1;
60 static PyObject *__pyx_d2;
61 static PyObject *__pyx_d3;
62 static PyObject *__pyx_d4;
63 static PyObject *__pyx_d5;
64 static PyObject *__pyx_d6;
65 static PyObject *__pyx_d7;
68 /* Implementation of kwonlyargs */
70 static PyObject *__pyx_f_10kwonlyargs_c(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
71 static PyObject *__pyx_f_10kwonlyargs_c(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
72 PyObject *__pyx_v_a = 0;
73 PyObject *__pyx_v_b = 0;
74 PyObject *__pyx_v_c = 0;
75 PyObject *__pyx_v_z;
76 PyObject *__pyx_r;
77 PyObject *__pyx_1 = 0;
78 static char *__pyx_argnames[] = {"a","b","c",0};
79 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO", __pyx_argnames, &__pyx_v_a, &__pyx_v_b, &__pyx_v_c)) return 0;
80 Py_INCREF(__pyx_v_a);
81 Py_INCREF(__pyx_v_b);
82 Py_INCREF(__pyx_v_c);
83 __pyx_v_z = Py_None; Py_INCREF(Py_None);
84 __pyx_1 = PyInt_FromLong(33); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; goto __pyx_L1;}
85 Py_DECREF(__pyx_v_z);
86 __pyx_v_z = __pyx_1;
87 __pyx_1 = 0;
89 __pyx_r = Py_None; Py_INCREF(Py_None);
90 goto __pyx_L0;
91 __pyx_L1:;
92 Py_XDECREF(__pyx_1);
93 __Pyx_AddTraceback("kwonlyargs.c");
94 __pyx_r = 0;
95 __pyx_L0:;
96 Py_DECREF(__pyx_v_z);
97 Py_DECREF(__pyx_v_a);
98 Py_DECREF(__pyx_v_b);
99 Py_DECREF(__pyx_v_c);
100 return __pyx_r;
101 }
103 static PyObject *__pyx_f_10kwonlyargs_d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
104 static PyObject *__pyx_f_10kwonlyargs_d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
105 PyObject *__pyx_v_a = 0;
106 PyObject *__pyx_v_b = 0;
107 PyObject *__pyx_v_c = 0;
108 PyObject *__pyx_v_z;
109 PyObject *__pyx_r;
110 PyObject *__pyx_1 = 0;
111 static char *__pyx_argnames[] = {"a","b","c",0};
112 __pyx_v_c = __pyx_d1;
113 if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 2, 0, 0, 0) < 0) return 0;
114 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_b, &__pyx_v_c)) {
115 Py_XDECREF(__pyx_args);
116 Py_XDECREF(__pyx_kwds);
117 return 0;
118 }
119 Py_INCREF(__pyx_v_a);
120 Py_INCREF(__pyx_v_b);
121 Py_INCREF(__pyx_v_c);
122 __pyx_v_z = Py_None; Py_INCREF(Py_None);
123 __pyx_1 = PyInt_FromLong(44); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
124 Py_DECREF(__pyx_v_z);
125 __pyx_v_z = __pyx_1;
126 __pyx_1 = 0;
128 __pyx_r = Py_None; Py_INCREF(Py_None);
129 goto __pyx_L0;
130 __pyx_L1:;
131 Py_XDECREF(__pyx_1);
132 __Pyx_AddTraceback("kwonlyargs.d");
133 __pyx_r = 0;
134 __pyx_L0:;
135 Py_DECREF(__pyx_v_z);
136 Py_DECREF(__pyx_v_a);
137 Py_DECREF(__pyx_v_b);
138 Py_DECREF(__pyx_v_c);
139 Py_XDECREF(__pyx_args);
140 Py_XDECREF(__pyx_kwds);
141 return __pyx_r;
142 }
144 static PyObject *__pyx_f_10kwonlyargs_e(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
145 static PyObject *__pyx_f_10kwonlyargs_e(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
146 PyObject *__pyx_v_a = 0;
147 PyObject *__pyx_v_b = 0;
148 PyObject *__pyx_v_c = 0;
149 PyObject *__pyx_v_kwds = 0;
150 PyObject *__pyx_v_z;
151 PyObject *__pyx_r;
152 PyObject *__pyx_1 = 0;
153 static char *__pyx_argnames[] = {"a","b","c",0};
154 __pyx_v_c = __pyx_d2;
155 if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 3, 0, &__pyx_v_kwds, 0) < 0) return 0;
156 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_b, &__pyx_v_c)) {
157 Py_XDECREF(__pyx_args);
158 Py_XDECREF(__pyx_kwds);
159 Py_XDECREF(__pyx_v_kwds);
160 return 0;
161 }
162 Py_INCREF(__pyx_v_a);
163 Py_INCREF(__pyx_v_b);
164 Py_INCREF(__pyx_v_c);
165 __pyx_v_z = Py_None; Py_INCREF(Py_None);
166 __pyx_1 = PyInt_FromLong(55); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; goto __pyx_L1;}
167 Py_DECREF(__pyx_v_z);
168 __pyx_v_z = __pyx_1;
169 __pyx_1 = 0;
171 __pyx_r = Py_None; Py_INCREF(Py_None);
172 goto __pyx_L0;
173 __pyx_L1:;
174 Py_XDECREF(__pyx_1);
175 __Pyx_AddTraceback("kwonlyargs.e");
176 __pyx_r = 0;
177 __pyx_L0:;
178 Py_XDECREF(__pyx_v_kwds);
179 Py_DECREF(__pyx_v_z);
180 Py_DECREF(__pyx_v_a);
181 Py_DECREF(__pyx_v_b);
182 Py_DECREF(__pyx_v_c);
183 Py_XDECREF(__pyx_args);
184 Py_XDECREF(__pyx_kwds);
185 return __pyx_r;
186 }
188 static PyObject *__pyx_f_10kwonlyargs_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
189 static PyObject *__pyx_f_10kwonlyargs_f(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
190 PyObject *__pyx_v_a = 0;
191 PyObject *__pyx_v_b = 0;
192 PyObject *__pyx_v_c = 0;
193 PyObject *__pyx_v_d = 0;
194 PyObject *__pyx_v_z;
195 PyObject *__pyx_r;
196 PyObject *__pyx_1 = 0;
197 static char *__pyx_argnames[] = {"a","b","c","d",0};
198 static char __pyx_reqd_kwds[] = {0,0,1,0};
199 __pyx_v_d = __pyx_d3;
200 if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 2, 0, 0, __pyx_reqd_kwds) < 0) return 0;
201 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_b, &__pyx_v_c, &__pyx_v_d)) {
202 Py_XDECREF(__pyx_args);
203 Py_XDECREF(__pyx_kwds);
204 return 0;
205 }
206 Py_INCREF(__pyx_v_a);
207 Py_INCREF(__pyx_v_b);
208 Py_INCREF(__pyx_v_c);
209 Py_INCREF(__pyx_v_d);
210 __pyx_v_z = Py_None; Py_INCREF(Py_None);
211 __pyx_1 = PyInt_FromLong(66); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;}
212 Py_DECREF(__pyx_v_z);
213 __pyx_v_z = __pyx_1;
214 __pyx_1 = 0;
216 __pyx_r = Py_None; Py_INCREF(Py_None);
217 goto __pyx_L0;
218 __pyx_L1:;
219 Py_XDECREF(__pyx_1);
220 __Pyx_AddTraceback("kwonlyargs.f");
221 __pyx_r = 0;
222 __pyx_L0:;
223 Py_DECREF(__pyx_v_z);
224 Py_DECREF(__pyx_v_a);
225 Py_DECREF(__pyx_v_b);
226 Py_DECREF(__pyx_v_c);
227 Py_DECREF(__pyx_v_d);
228 Py_XDECREF(__pyx_args);
229 Py_XDECREF(__pyx_kwds);
230 return __pyx_r;
231 }
233 static PyObject *__pyx_f_10kwonlyargs_g(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
234 static PyObject *__pyx_f_10kwonlyargs_g(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
235 PyObject *__pyx_v_a = 0;
236 PyObject *__pyx_v_b = 0;
237 PyObject *__pyx_v_c = 0;
238 PyObject *__pyx_v_d = 0;
239 PyObject *__pyx_v_e = 0;
240 PyObject *__pyx_v_f = 0;
241 PyObject *__pyx_v_kwds = 0;
242 PyObject *__pyx_v_z;
243 PyObject *__pyx_r;
244 PyObject *__pyx_1 = 0;
245 static char *__pyx_argnames[] = {"a","b","c","d","e","f",0};
246 static char __pyx_reqd_kwds[] = {0,0,1,0,0,1};
247 __pyx_v_d = __pyx_d4;
248 __pyx_v_e = __pyx_d5;
249 if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 2, 0, &__pyx_v_kwds, __pyx_reqd_kwds) < 0) return 0;
250 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO|OOO", __pyx_argnames, &__pyx_v_a, &__pyx_v_b, &__pyx_v_c, &__pyx_v_d, &__pyx_v_e, &__pyx_v_f)) {
251 Py_XDECREF(__pyx_args);
252 Py_XDECREF(__pyx_kwds);
253 Py_XDECREF(__pyx_v_kwds);
254 return 0;
255 }
256 Py_INCREF(__pyx_v_a);
257 Py_INCREF(__pyx_v_b);
258 Py_INCREF(__pyx_v_c);
259 Py_INCREF(__pyx_v_d);
260 Py_INCREF(__pyx_v_e);
261 Py_INCREF(__pyx_v_f);
262 __pyx_v_z = Py_None; Py_INCREF(Py_None);
263 __pyx_1 = PyInt_FromLong(77); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; goto __pyx_L1;}
264 Py_DECREF(__pyx_v_z);
265 __pyx_v_z = __pyx_1;
266 __pyx_1 = 0;
268 __pyx_r = Py_None; Py_INCREF(Py_None);
269 goto __pyx_L0;
270 __pyx_L1:;
271 Py_XDECREF(__pyx_1);
272 __Pyx_AddTraceback("kwonlyargs.g");
273 __pyx_r = 0;
274 __pyx_L0:;
275 Py_XDECREF(__pyx_v_kwds);
276 Py_DECREF(__pyx_v_z);
277 Py_DECREF(__pyx_v_a);
278 Py_DECREF(__pyx_v_b);
279 Py_DECREF(__pyx_v_c);
280 Py_DECREF(__pyx_v_d);
281 Py_DECREF(__pyx_v_e);
282 Py_DECREF(__pyx_v_f);
283 Py_XDECREF(__pyx_args);
284 Py_XDECREF(__pyx_kwds);
285 return __pyx_r;
286 }
288 static PyObject *__pyx_f_10kwonlyargs_h(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
289 static PyObject *__pyx_f_10kwonlyargs_h(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
290 PyObject *__pyx_v_a = 0;
291 PyObject *__pyx_v_b = 0;
292 PyObject *__pyx_v_c = 0;
293 PyObject *__pyx_v_d = 0;
294 PyObject *__pyx_v_e = 0;
295 PyObject *__pyx_v_f = 0;
296 PyObject *__pyx_v_args = 0;
297 PyObject *__pyx_v_kwds = 0;
298 PyObject *__pyx_v_z;
299 PyObject *__pyx_r;
300 PyObject *__pyx_1 = 0;
301 static char *__pyx_argnames[] = {"a","b","c","d","e","f",0};
302 static char __pyx_reqd_kwds[] = {0,0,1,0,0,1};
303 __pyx_v_d = __pyx_d6;
304 __pyx_v_e = __pyx_d7;
305 if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 2, &__pyx_v_args, &__pyx_v_kwds, __pyx_reqd_kwds) < 0) return 0;
306 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO|OOO", __pyx_argnames, &__pyx_v_a, &__pyx_v_b, &__pyx_v_c, &__pyx_v_d, &__pyx_v_e, &__pyx_v_f)) {
307 Py_XDECREF(__pyx_args);
308 Py_XDECREF(__pyx_kwds);
309 Py_XDECREF(__pyx_v_args);
310 Py_XDECREF(__pyx_v_kwds);
311 return 0;
312 }
313 Py_INCREF(__pyx_v_a);
314 Py_INCREF(__pyx_v_b);
315 Py_INCREF(__pyx_v_c);
316 Py_INCREF(__pyx_v_d);
317 Py_INCREF(__pyx_v_e);
318 Py_INCREF(__pyx_v_f);
319 __pyx_v_z = Py_None; Py_INCREF(Py_None);
320 __pyx_1 = PyInt_FromLong(88); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;}
321 Py_DECREF(__pyx_v_z);
322 __pyx_v_z = __pyx_1;
323 __pyx_1 = 0;
325 __pyx_r = Py_None; Py_INCREF(Py_None);
326 goto __pyx_L0;
327 __pyx_L1:;
328 Py_XDECREF(__pyx_1);
329 __Pyx_AddTraceback("kwonlyargs.h");
330 __pyx_r = 0;
331 __pyx_L0:;
332 Py_XDECREF(__pyx_v_args);
333 Py_XDECREF(__pyx_v_kwds);
334 Py_DECREF(__pyx_v_z);
335 Py_DECREF(__pyx_v_a);
336 Py_DECREF(__pyx_v_b);
337 Py_DECREF(__pyx_v_c);
338 Py_DECREF(__pyx_v_d);
339 Py_DECREF(__pyx_v_e);
340 Py_DECREF(__pyx_v_f);
341 Py_XDECREF(__pyx_args);
342 Py_XDECREF(__pyx_kwds);
343 return __pyx_r;
344 }
346 static struct PyMethodDef __pyx_methods[] = {
347 {"c", (PyCFunction)__pyx_f_10kwonlyargs_c, METH_VARARGS|METH_KEYWORDS, 0},
348 {"d", (PyCFunction)__pyx_f_10kwonlyargs_d, METH_VARARGS|METH_KEYWORDS, 0},
349 {"e", (PyCFunction)__pyx_f_10kwonlyargs_e, METH_VARARGS|METH_KEYWORDS, 0},
350 {"f", (PyCFunction)__pyx_f_10kwonlyargs_f, METH_VARARGS|METH_KEYWORDS, 0},
351 {"g", (PyCFunction)__pyx_f_10kwonlyargs_g, METH_VARARGS|METH_KEYWORDS, 0},
352 {"h", (PyCFunction)__pyx_f_10kwonlyargs_h, METH_VARARGS|METH_KEYWORDS, 0},
353 {0, 0, 0, 0}
354 };
356 static void __pyx_init_filenames(void); /*proto*/
358 PyMODINIT_FUNC initkwonlyargs(void); /*proto*/
359 PyMODINIT_FUNC initkwonlyargs(void) {
360 PyObject *__pyx_1 = 0;
361 PyObject *__pyx_2 = 0;
362 PyObject *__pyx_3 = 0;
363 PyObject *__pyx_4 = 0;
364 PyObject *__pyx_5 = 0;
365 PyObject *__pyx_6 = 0;
366 PyObject *__pyx_7 = 0;
367 __pyx_init_filenames();
368 __pyx_m = Py_InitModule4("kwonlyargs", __pyx_methods, 0, 0, PYTHON_API_VERSION);
369 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
370 Py_INCREF(__pyx_m);
371 __pyx_b = PyImport_AddModule("__builtin__");
372 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
373 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
374 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
376 /* "/Local/Projects/D/Pyrex/Source/Tests/9/kwonlyargs.pyx":4 */
377 __pyx_1 = PyInt_FromLong(88); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;}
378 __pyx_d1 = __pyx_1;
379 __pyx_1 = 0;
381 /* "/Local/Projects/D/Pyrex/Source/Tests/9/kwonlyargs.pyx":7 */
382 __pyx_2 = PyInt_FromLong(88); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
383 __pyx_d2 = __pyx_2;
384 __pyx_2 = 0;
386 /* "/Local/Projects/D/Pyrex/Source/Tests/9/kwonlyargs.pyx":10 */
387 __pyx_3 = PyInt_FromLong(42); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
388 __pyx_d3 = __pyx_3;
389 __pyx_3 = 0;
391 /* "/Local/Projects/D/Pyrex/Source/Tests/9/kwonlyargs.pyx":13 */
392 __pyx_4 = PyInt_FromLong(42); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; goto __pyx_L1;}
393 __pyx_d4 = __pyx_4;
394 __pyx_4 = 0;
395 __pyx_5 = PyInt_FromLong(17); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; goto __pyx_L1;}
396 __pyx_d5 = __pyx_5;
397 __pyx_5 = 0;
399 /* "/Local/Projects/D/Pyrex/Source/Tests/9/kwonlyargs.pyx":16 */
400 __pyx_6 = PyInt_FromLong(42); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;}
401 __pyx_d6 = __pyx_6;
402 __pyx_6 = 0;
403 __pyx_7 = PyInt_FromLong(17); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L1;}
404 __pyx_d7 = __pyx_7;
405 __pyx_7 = 0;
406 return;
407 __pyx_L1:;
408 Py_XDECREF(__pyx_1);
409 Py_XDECREF(__pyx_2);
410 Py_XDECREF(__pyx_3);
411 Py_XDECREF(__pyx_4);
412 Py_XDECREF(__pyx_5);
413 Py_XDECREF(__pyx_6);
414 Py_XDECREF(__pyx_7);
415 __Pyx_AddTraceback("kwonlyargs");
416 }
418 static char *__pyx_filenames[] = {
419 "kwonlyargs.pyx",
420 };
422 /* Runtime support code */
424 static void __pyx_init_filenames(void) {
425 __pyx_f = __pyx_filenames;
426 }
428 static int __Pyx_GetStarArgs(
429 PyObject **args,
430 PyObject **kwds,
431 char *kwd_list[],
432 Py_ssize_t nargs,
433 PyObject **args2,
434 PyObject **kwds2,
435 char rqd_kwds[])
436 {
437 PyObject *x = 0, *args1 = 0, *kwds1 = 0;
438 int i;
439 char **p;
441 if (args2)
442 *args2 = 0;
443 if (kwds2)
444 *kwds2 = 0;
446 if (args2) {
447 args1 = PyTuple_GetSlice(*args, 0, nargs);
448 if (!args1)
449 goto bad;
450 *args2 = PyTuple_GetSlice(*args, nargs, PyTuple_GET_SIZE(*args));
451 if (!*args2)
452 goto bad;
453 }
454 else if (PyTuple_GET_SIZE(*args) > nargs) {
455 int m = nargs;
456 int n = PyTuple_GET_SIZE(*args);
457 PyErr_Format(PyExc_TypeError,
458 "function takes at most %d positional arguments (%d given)",
459 m, n);
460 goto bad;
461 }
462 else {
463 args1 = *args;
464 Py_INCREF(args1);
465 }
467 if (rqd_kwds && !*kwds)
468 for (i = 0, p = kwd_list; *p; i++, p++)
469 if (rqd_kwds[i])
470 goto missing_kwarg;
472 if (kwds2) {
473 if (*kwds) {
474 kwds1 = PyDict_New();
475 if (!kwds1)
476 goto bad;
477 *kwds2 = PyDict_Copy(*kwds);
478 if (!*kwds2)
479 goto bad;
480 for (i = 0, p = kwd_list; *p; i++, p++) {
481 x = PyDict_GetItemString(*kwds, *p);
482 if (x) {
483 if (PyDict_SetItemString(kwds1, *p, x) < 0)
484 goto bad;
485 if (PyDict_DelItemString(*kwds2, *p) < 0)
486 goto bad;
487 }
488 else if (rqd_kwds && rqd_kwds[i])
489 goto missing_kwarg;
490 }
491 }
492 else {
493 *kwds2 = PyDict_New();
494 if (!*kwds2)
495 goto bad;
496 }
497 }
498 else {
499 kwds1 = *kwds;
500 Py_XINCREF(kwds1);
501 if (rqd_kwds && *kwds)
502 for (i = 0, p = kwd_list; *p; i++, p++)
503 if (rqd_kwds[i] && !PyDict_GetItemString(*kwds, *p))
504 goto missing_kwarg;
505 }
507 *args = args1;
508 *kwds = kwds1;
509 return 0;
510 missing_kwarg:
511 PyErr_Format(PyExc_TypeError,
512 "required keyword argument '%s' is missing", *p);
513 bad:
514 Py_XDECREF(args1);
515 Py_XDECREF(kwds1);
516 if (args2) {
517 Py_XDECREF(*args2);
518 }
519 if (kwds2) {
520 Py_XDECREF(*kwds2);
521 }
522 return -1;
523 }
525 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
526 while (t->p) {
527 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
528 if (!*t->p)
529 return -1;
530 if (t->i)
531 PyString_InternInPlace(t->p);
532 ++t;
533 }
534 return 0;
535 }
537 #include "compile.h"
538 #include "frameobject.h"
539 #include "traceback.h"
541 static void __Pyx_AddTraceback(char *funcname) {
542 PyObject *py_srcfile = 0;
543 PyObject *py_funcname = 0;
544 PyObject *py_globals = 0;
545 PyObject *empty_tuple = 0;
546 PyObject *empty_string = 0;
547 PyCodeObject *py_code = 0;
548 PyFrameObject *py_frame = 0;
550 py_srcfile = PyString_FromString(__pyx_filename);
551 if (!py_srcfile) goto bad;
552 py_funcname = PyString_FromString(funcname);
553 if (!py_funcname) goto bad;
554 py_globals = PyModule_GetDict(__pyx_m);
555 if (!py_globals) goto bad;
556 empty_tuple = PyTuple_New(0);
557 if (!empty_tuple) goto bad;
558 empty_string = PyString_FromString("");
559 if (!empty_string) goto bad;
560 py_code = PyCode_New(
561 0, /*int argcount,*/
562 0, /*int nlocals,*/
563 0, /*int stacksize,*/
564 0, /*int flags,*/
565 empty_string, /*PyObject *code,*/
566 empty_tuple, /*PyObject *consts,*/
567 empty_tuple, /*PyObject *names,*/
568 empty_tuple, /*PyObject *varnames,*/
569 empty_tuple, /*PyObject *freevars,*/
570 empty_tuple, /*PyObject *cellvars,*/
571 py_srcfile, /*PyObject *filename,*/
572 py_funcname, /*PyObject *name,*/
573 __pyx_lineno, /*int firstlineno,*/
574 empty_string /*PyObject *lnotab*/
575 );
576 if (!py_code) goto bad;
577 py_frame = PyFrame_New(
578 PyThreadState_Get(), /*PyThreadState *tstate,*/
579 py_code, /*PyCodeObject *code,*/
580 py_globals, /*PyObject *globals,*/
581 0 /*PyObject *locals*/
582 );
583 if (!py_frame) goto bad;
584 py_frame->f_lineno = __pyx_lineno;
585 PyTraceBack_Here(py_frame);
586 bad:
587 Py_XDECREF(py_srcfile);
588 Py_XDECREF(py_funcname);
589 Py_XDECREF(empty_tuple);
590 Py_XDECREF(empty_string);
591 Py_XDECREF(py_code);
592 Py_XDECREF(py_frame);
593 }
