Cython has moved to github.

pyrex

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