Cython has moved to github.

pyrex

view Tests/9/Reference/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 6c5f5271ebab
children a4cf19f0065a
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 void __Pyx_AddTraceback(char *funcname); /*proto*/
43 /* Declarations from withnogil */
45 static PyObject *__pyx_f_9withnogil_f(PyObject *); /*proto*/
46 static PyObject *__pyx_f_9withnogil_g(void); /*proto*/
47 static int __pyx_f_9withnogil_h(void); /*proto*/
50 static __Pyx_StringTabEntry __pyx_string_tab[] = {
51 {0, 0, 0, 0}
52 };
54 /* Implementation of withnogil */
56 static PyObject *__pyx_f_9withnogil_f(PyObject *__pyx_v_x) {
57 PyObject *__pyx_r;
58 Py_INCREF(__pyx_v_x);
60 /* "/Local/Projects/D/Pyrex/Source/Tests/9/withnogil.pyx":4 */
61 /*with nogil:*/ {
62 PyThreadState *_save;
63 Py_UNBLOCK_THREADS
64 /*try:*/ {
65 }
66 /*finally:*/ {
67 Py_BLOCK_THREADS
68 }
69 }
71 __pyx_r = Py_None; Py_INCREF(Py_None);
72 Py_DECREF(__pyx_v_x);
73 return __pyx_r;
74 }
76 static PyObject *__pyx_f_9withnogil_g(void) {
77 PyObject *__pyx_r;
78 int __pyx_1;
79 /*with nogil:*/ {
80 PyThreadState *_save;
81 Py_UNBLOCK_THREADS
82 /*try:*/ {
83 __pyx_1 = __pyx_f_9withnogil_h(); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L3;}
84 }
85 /*finally:*/ {
86 int __pyx_why;
87 __pyx_why = 0; goto __pyx_L4;
88 __pyx_L3: __pyx_why = 4; goto __pyx_L4;
89 __pyx_L4:;
90 Py_BLOCK_THREADS
91 switch (__pyx_why) {
92 case 4: goto __pyx_L1;
93 }
94 }
95 }
97 __pyx_r = Py_None; Py_INCREF(Py_None);
98 goto __pyx_L0;
99 __pyx_L1:;
100 __Pyx_AddTraceback("withnogil.g");
101 __pyx_r = 0;
102 __pyx_L0:;
103 return __pyx_r;
104 }
106 static int __pyx_f_9withnogil_h(void) {
107 int __pyx_r;
109 __pyx_r = 0;
110 return __pyx_r;
111 }
113 static struct PyMethodDef __pyx_methods[] = {
114 {0, 0, 0, 0}
115 };
117 static void __pyx_init_filenames(void); /*proto*/
119 PyMODINIT_FUNC initwithnogil(void); /*proto*/
120 PyMODINIT_FUNC initwithnogil(void) {
121 __pyx_init_filenames();
122 __pyx_m = Py_InitModule4("withnogil", __pyx_methods, 0, 0, PYTHON_API_VERSION);
123 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
124 Py_INCREF(__pyx_m);
125 __pyx_b = PyImport_AddModule("__builtin__");
126 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
127 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
128 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
130 /* "/Local/Projects/D/Pyrex/Source/Tests/9/withnogil.pyx":12 */
131 return;
132 __pyx_L1:;
133 __Pyx_AddTraceback("withnogil");
134 }
136 static char *__pyx_filenames[] = {
137 "withnogil.pyx",
138 };
140 /* Runtime support code */
142 static void __pyx_init_filenames(void) {
143 __pyx_f = __pyx_filenames;
144 }
146 #include "compile.h"
147 #include "frameobject.h"
148 #include "traceback.h"
150 static void __Pyx_AddTraceback(char *funcname) {
151 PyObject *py_srcfile = 0;
152 PyObject *py_funcname = 0;
153 PyObject *py_globals = 0;
154 PyObject *empty_tuple = 0;
155 PyObject *empty_string = 0;
156 PyCodeObject *py_code = 0;
157 PyFrameObject *py_frame = 0;
159 py_srcfile = PyString_FromString(__pyx_filename);
160 if (!py_srcfile) goto bad;
161 py_funcname = PyString_FromString(funcname);
162 if (!py_funcname) goto bad;
163 py_globals = PyModule_GetDict(__pyx_m);
164 if (!py_globals) goto bad;
165 empty_tuple = PyTuple_New(0);
166 if (!empty_tuple) goto bad;
167 empty_string = PyString_FromString("");
168 if (!empty_string) goto bad;
169 py_code = PyCode_New(
170 0, /*int argcount,*/
171 0, /*int nlocals,*/
172 0, /*int stacksize,*/
173 0, /*int flags,*/
174 empty_string, /*PyObject *code,*/
175 empty_tuple, /*PyObject *consts,*/
176 empty_tuple, /*PyObject *names,*/
177 empty_tuple, /*PyObject *varnames,*/
178 empty_tuple, /*PyObject *freevars,*/
179 empty_tuple, /*PyObject *cellvars,*/
180 py_srcfile, /*PyObject *filename,*/
181 py_funcname, /*PyObject *name,*/
182 __pyx_lineno, /*int firstlineno,*/
183 empty_string /*PyObject *lnotab*/
184 );
185 if (!py_code) goto bad;
186 py_frame = PyFrame_New(
187 PyThreadState_Get(), /*PyThreadState *tstate,*/
188 py_code, /*PyCodeObject *code,*/
189 py_globals, /*PyObject *globals,*/
190 0 /*PyObject *locals*/
191 );
192 if (!py_frame) goto bad;
193 py_frame->f_lineno = __pyx_lineno;
194 PyTraceBack_Here(py_frame);
195 bad:
196 Py_XDECREF(py_srcfile);
197 Py_XDECREF(py_funcname);
198 Py_XDECREF(empty_tuple);
199 Py_XDECREF(empty_string);
200 Py_XDECREF(py_code);
201 Py_XDECREF(py_frame);
202 }