Cython has moved to github.

pyrex

view Tests/9/withnogil.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_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
42 static void __Pyx_AddTraceback(char *funcname); /*proto*/
44 /* Declarations from withnogil */
47 /* Declarations from implementation of withnogil */
49 static PyObject *__pyx_f_9withnogil_f(PyObject *); /*proto*/
50 static PyObject *__pyx_f_9withnogil_g(void); /*proto*/
51 static int __pyx_f_9withnogil_h(void); /*proto*/
56 static __Pyx_StringTabEntry __pyx_string_tab[] = {
57 {0, 0, 0, 0}
58 };
62 /* Implementation of withnogil */
64 static PyObject *__pyx_f_9withnogil_f(PyObject *__pyx_v_x) {
65 PyObject *__pyx_r;
66 Py_INCREF(__pyx_v_x);
68 /* "/Local/Projects/D/Pyrex/Source/Tests/9/withnogil.pyx":4 */
69 /*with nogil:*/ {
70 PyThreadState *_save;
71 Py_UNBLOCK_THREADS
72 /*try:*/ {
73 }
74 /*finally:*/ {
75 Py_BLOCK_THREADS
76 }
77 }
79 __pyx_r = Py_None; Py_INCREF(Py_None);
80 Py_DECREF(__pyx_v_x);
81 return __pyx_r;
82 }
84 static PyObject *__pyx_f_9withnogil_g(void) {
85 PyObject *__pyx_r;
86 int __pyx_1;
87 /*with nogil:*/ {
88 PyThreadState *_save;
89 Py_UNBLOCK_THREADS
90 /*try:*/ {
91 __pyx_1 = __pyx_f_9withnogil_h(); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L3;}
92 }
93 /*finally:*/ {
94 int __pyx_why;
95 __pyx_why = 0; goto __pyx_L4;
96 __pyx_L3: __pyx_why = 4; goto __pyx_L4;
97 __pyx_L4:;
98 Py_BLOCK_THREADS
99 switch (__pyx_why) {
100 case 4: goto __pyx_L1;
101 }
102 }
103 }
105 __pyx_r = Py_None; Py_INCREF(Py_None);
106 goto __pyx_L0;
107 __pyx_L1:;
108 __Pyx_AddTraceback("withnogil.g");
109 __pyx_r = 0;
110 __pyx_L0:;
111 return __pyx_r;
112 }
114 static int __pyx_f_9withnogil_h(void) {
115 int __pyx_r;
117 __pyx_r = 0;
118 return __pyx_r;
119 }
121 static struct PyMethodDef __pyx_methods[] = {
122 {0, 0, 0, 0}
123 };
125 static void __pyx_init_filenames(void); /*proto*/
127 PyMODINIT_FUNC initwithnogil(void); /*proto*/
128 PyMODINIT_FUNC initwithnogil(void) {
129 __pyx_init_filenames();
130 __pyx_m = Py_InitModule4("withnogil", __pyx_methods, 0, 0, PYTHON_API_VERSION);
131 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
132 Py_INCREF(__pyx_m);
133 __pyx_b = PyImport_AddModule("__builtin__");
134 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
135 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
136 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
138 /* "/Local/Projects/D/Pyrex/Source/Tests/9/withnogil.pyx":12 */
139 return;
140 __pyx_L1:;
141 __Pyx_AddTraceback("withnogil");
142 }
144 static char *__pyx_filenames[] = {
145 "withnogil.pyx",
146 };
148 /* Runtime support code */
150 static void __pyx_init_filenames(void) {
151 __pyx_f = __pyx_filenames;
152 }
154 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
155 while (t->p) {
156 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
157 if (!*t->p)
158 return -1;
159 if (t->i)
160 PyString_InternInPlace(t->p);
161 ++t;
162 }
163 return 0;
164 }
166 #include "compile.h"
167 #include "frameobject.h"
168 #include "traceback.h"
170 static void __Pyx_AddTraceback(char *funcname) {
171 PyObject *py_srcfile = 0;
172 PyObject *py_funcname = 0;
173 PyObject *py_globals = 0;
174 PyObject *empty_tuple = 0;
175 PyObject *empty_string = 0;
176 PyCodeObject *py_code = 0;
177 PyFrameObject *py_frame = 0;
179 py_srcfile = PyString_FromString(__pyx_filename);
180 if (!py_srcfile) goto bad;
181 py_funcname = PyString_FromString(funcname);
182 if (!py_funcname) goto bad;
183 py_globals = PyModule_GetDict(__pyx_m);
184 if (!py_globals) goto bad;
185 empty_tuple = PyTuple_New(0);
186 if (!empty_tuple) goto bad;
187 empty_string = PyString_FromString("");
188 if (!empty_string) goto bad;
189 py_code = PyCode_New(
190 0, /*int argcount,*/
191 0, /*int nlocals,*/
192 0, /*int stacksize,*/
193 0, /*int flags,*/
194 empty_string, /*PyObject *code,*/
195 empty_tuple, /*PyObject *consts,*/
196 empty_tuple, /*PyObject *names,*/
197 empty_tuple, /*PyObject *varnames,*/
198 empty_tuple, /*PyObject *freevars,*/
199 empty_tuple, /*PyObject *cellvars,*/
200 py_srcfile, /*PyObject *filename,*/
201 py_funcname, /*PyObject *name,*/
202 __pyx_lineno, /*int firstlineno,*/
203 empty_string /*PyObject *lnotab*/
204 );
205 if (!py_code) goto bad;
206 py_frame = PyFrame_New(
207 PyThreadState_Get(), /*PyThreadState *tstate,*/
208 py_code, /*PyCodeObject *code,*/
209 py_globals, /*PyObject *globals,*/
210 0 /*PyObject *locals*/
211 );
212 if (!py_frame) goto bad;
213 py_frame->f_lineno = __pyx_lineno;
214 PyTraceBack_Here(py_frame);
215 bad:
216 Py_XDECREF(py_srcfile);
217 Py_XDECREF(py_funcname);
218 Py_XDECREF(empty_tuple);
219 Py_XDECREF(empty_string);
220 Py_XDECREF(py_code);
221 Py_XDECREF(py_frame);
222 }