Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: third_party/twisted_8_1/twisted/test/raiser.c

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /* Generated by Pyrex 0.9.5.1a on Wed Apr 9 19:55:33 2008 */
2
3 #include "Python.h"
4 #include "structmember.h"
5 #ifndef PY_LONG_LONG
6 #define PY_LONG_LONG LONG_LONG
7 #endif
8 #ifdef __cplusplus
9 #define __PYX_EXTERN_C extern "C"
10 #else
11 #define __PYX_EXTERN_C extern
12 #endif
13 __PYX_EXTERN_C double pow(double, double);
14
15
16 typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
17 typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
18
19 static PyObject *__pyx_m;
20 static PyObject *__pyx_b;
21 static int __pyx_lineno;
22 static char *__pyx_filename;
23 static char **__pyx_f;
24
25 static char __pyx_mdoc[] = "\nA trivial extension that just raises an exception. \nSee L{twisted.test.test_failure.test_failureConstructionWithMungedStackSucceed s}.\n";
26
27 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
28
29 static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *na me, char *modname); /*proto*/
30
31 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto* /
32
33 static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
34
35 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
36
37 static void __Pyx_AddTraceback(char *funcname); /*proto*/
38
39 /* Declarations from raiser */
40
41
42
43 /* Implementation of raiser */
44
45 static char (__pyx_k2[]) = "\n A speficic exception only used to be identifie d in tests.\n ";
46
47 static PyObject *__pyx_n_RaiserException;
48 static PyObject *__pyx_n_raiseException;
49 static PyObject *__pyx_n_Exception;
50
51 static PyObject *__pyx_k2p;
52
53 static PyObject *__pyx_k3p;
54
55 static char (__pyx_k3[]) = "This function is intentionally broken";
56
57 static PyObject *__pyx_f_6raiser_raiseException(PyObject *__pyx_self, PyObject * __pyx_args, PyObject *__pyx_kwds); /*proto*/
58 static char __pyx_doc_6raiser_raiseException[] = "\n Raise L{RaiserException} .\n ";
59 static PyObject *__pyx_f_6raiser_raiseException(PyObject *__pyx_self, PyObject * __pyx_args, PyObject *__pyx_kwds) {
60 PyObject *__pyx_r;
61 PyObject *__pyx_1 = 0;
62 PyObject *__pyx_2 = 0;
63 PyObject *__pyx_3 = 0;
64 static char *__pyx_argnames[] = {0};
65 if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
66
67 /* "/home/therve/Projects/Twisted/branches/failure-c-extension-3132/twisted/te st/raiser.pyx":21 */
68 __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_RaiserException); if (!__pyx_1) {__py x_filename = __pyx_f[0]; __pyx_lineno = 21; goto __pyx_L1;}
69 __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_li neno = 21; goto __pyx_L1;}
70 Py_INCREF(__pyx_k3p);
71 PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k3p);
72 __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; goto __pyx_L1;}
73 Py_DECREF(__pyx_1); __pyx_1 = 0;
74 Py_DECREF(__pyx_2); __pyx_2 = 0;
75 __Pyx_Raise(__pyx_3, 0, 0);
76 Py_DECREF(__pyx_3); __pyx_3 = 0;
77 {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; goto __pyx_L1;}
78
79 __pyx_r = Py_None; Py_INCREF(Py_None);
80 goto __pyx_L0;
81 __pyx_L1:;
82 Py_XDECREF(__pyx_1);
83 Py_XDECREF(__pyx_2);
84 Py_XDECREF(__pyx_3);
85 __Pyx_AddTraceback("raiser.raiseException");
86 __pyx_r = 0;
87 __pyx_L0:;
88 return __pyx_r;
89 }
90
91 static __Pyx_InternTabEntry __pyx_intern_tab[] = {
92 {&__pyx_n_Exception, "Exception"},
93 {&__pyx_n_RaiserException, "RaiserException"},
94 {&__pyx_n_raiseException, "raiseException"},
95 {0, 0}
96 };
97
98 static __Pyx_StringTabEntry __pyx_string_tab[] = {
99 {&__pyx_k2p, __pyx_k2, sizeof(__pyx_k2)},
100 {&__pyx_k3p, __pyx_k3, sizeof(__pyx_k3)},
101 {0, 0, 0}
102 };
103
104 static struct PyMethodDef __pyx_methods[] = {
105 {"raiseException", (PyCFunction)__pyx_f_6raiser_raiseException, METH_VARARGS|M ETH_KEYWORDS, __pyx_doc_6raiser_raiseException},
106 {0, 0, 0, 0}
107 };
108
109 static void __pyx_init_filenames(void); /*proto*/
110
111 PyMODINIT_FUNC initraiser(void); /*proto*/
112 PyMODINIT_FUNC initraiser(void) {
113 PyObject *__pyx_1 = 0;
114 PyObject *__pyx_2 = 0;
115 PyObject *__pyx_3 = 0;
116 __pyx_init_filenames();
117 __pyx_m = Py_InitModule4("raiser", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VE RSION);
118 if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
119 __pyx_b = PyImport_AddModule("__builtin__");
120 if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
121 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filen ame = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;};
122 if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; _ _pyx_lineno = 4; goto __pyx_L1;};
123 if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __p yx_lineno = 4; goto __pyx_L1;};
124
125 /* "/home/therve/Projects/Twisted/branches/failure-c-extension-3132/twisted/te st/raiser.pyx":11 */
126 __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_line no = 11; goto __pyx_L1;}
127 __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_Exception); if (!__pyx_2) {__pyx_file name = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;}
128 __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_li neno = 11; goto __pyx_L1;}
129 PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
130 __pyx_2 = 0;
131 if (PyDict_SetItemString(__pyx_1, "__doc__", __pyx_k2p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;}
132 __pyx_2 = __Pyx_CreateClass(__pyx_3, __pyx_1, __pyx_n_RaiserException, "raiser "); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1 ;}
133 Py_DECREF(__pyx_3); __pyx_3 = 0;
134 if (PyObject_SetAttr(__pyx_m, __pyx_n_RaiserException, __pyx_2) < 0) {__pyx_fi lename = __pyx_f[0]; __pyx_lineno = 11; goto __pyx_L1;}
135 Py_DECREF(__pyx_2); __pyx_2 = 0;
136 Py_DECREF(__pyx_1); __pyx_1 = 0;
137
138 /* "/home/therve/Projects/Twisted/branches/failure-c-extension-3132/twisted/te st/raiser.pyx":17 */
139 return;
140 __pyx_L1:;
141 Py_XDECREF(__pyx_1);
142 Py_XDECREF(__pyx_2);
143 Py_XDECREF(__pyx_3);
144 __Pyx_AddTraceback("raiser");
145 }
146
147 static char *__pyx_filenames[] = {
148 "raiser.pyx",
149 };
150
151 /* Runtime support code */
152
153 static void __pyx_init_filenames(void) {
154 __pyx_f = __pyx_filenames;
155 }
156
157 static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
158 PyObject *result;
159 result = PyObject_GetAttr(dict, name);
160 if (!result)
161 PyErr_SetObject(PyExc_NameError, name);
162 return result;
163 }
164
165 static PyObject *__Pyx_CreateClass(
166 PyObject *bases, PyObject *dict, PyObject *name, char *modname)
167 {
168 PyObject *py_modname;
169 PyObject *result = 0;
170
171 py_modname = PyString_FromString(modname);
172 if (!py_modname)
173 goto bad;
174 if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
175 goto bad;
176 result = PyClass_New(bases, dict, name);
177 bad:
178 Py_XDECREF(py_modname);
179 return result;
180 }
181
182 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
183 Py_XINCREF(type);
184 Py_XINCREF(value);
185 Py_XINCREF(tb);
186 /* First, check the traceback argument, replacing None with NULL. */
187 if (tb == Py_None) {
188 Py_DECREF(tb);
189 tb = 0;
190 }
191 else if (tb != NULL && !PyTraceBack_Check(tb)) {
192 PyErr_SetString(PyExc_TypeError,
193 "raise: arg 3 must be a traceback or None");
194 goto raise_error;
195 }
196 /* Next, replace a missing value with None */
197 if (value == NULL) {
198 value = Py_None;
199 Py_INCREF(value);
200 }
201 /* Next, repeatedly, replace a tuple exception with its first item */
202 while (PyTuple_Check(type) && PyTuple_Size(type) > 0) {
203 PyObject *tmp = type;
204 type = PyTuple_GET_ITEM(type, 0);
205 Py_INCREF(type);
206 Py_DECREF(tmp);
207 }
208 if (PyString_Check(type)) {
209 if (PyErr_Warn(PyExc_DeprecationWarning,
210 "raising a string exception is deprecated"))
211 goto raise_error;
212 }
213 else if (PyType_Check(type) || PyClass_Check(type))
214 ; /*PyErr_NormalizeException(&type, &value, &tb);*/
215 else {
216 /* Raising an instance. The value should be a dummy. */
217 if (value != Py_None) {
218 PyErr_SetString(PyExc_TypeError,
219 "instance exception may not have a separate value");
220 goto raise_error;
221 }
222 /* Normalize to raise <class>, <instance> */
223 Py_DECREF(value);
224 value = type;
225 if (PyInstance_Check(type))
226 type = (PyObject*) ((PyInstanceObject*)type)->in_class;
227 else
228 type = (PyObject*) type->ob_type;
229 Py_INCREF(type);
230 }
231 PyErr_Restore(type, value, tb);
232 return;
233 raise_error:
234 Py_XDECREF(value);
235 Py_XDECREF(type);
236 Py_XDECREF(tb);
237 return;
238 }
239
240 static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
241 while (t->p) {
242 *t->p = PyString_InternFromString(t->s);
243 if (!*t->p)
244 return -1;
245 ++t;
246 }
247 return 0;
248 }
249
250 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
251 while (t->p) {
252 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
253 if (!*t->p)
254 return -1;
255 ++t;
256 }
257 return 0;
258 }
259
260 #include "compile.h"
261 #include "frameobject.h"
262 #include "traceback.h"
263
264 static void __Pyx_AddTraceback(char *funcname) {
265 PyObject *py_srcfile = 0;
266 PyObject *py_funcname = 0;
267 PyObject *py_globals = 0;
268 PyObject *empty_tuple = 0;
269 PyObject *empty_string = 0;
270 PyCodeObject *py_code = 0;
271 PyFrameObject *py_frame = 0;
272
273 py_srcfile = PyString_FromString(__pyx_filename);
274 if (!py_srcfile) goto bad;
275 py_funcname = PyString_FromString(funcname);
276 if (!py_funcname) goto bad;
277 py_globals = PyModule_GetDict(__pyx_m);
278 if (!py_globals) goto bad;
279 empty_tuple = PyTuple_New(0);
280 if (!empty_tuple) goto bad;
281 empty_string = PyString_FromString("");
282 if (!empty_string) goto bad;
283 py_code = PyCode_New(
284 0, /*int argcount,*/
285 0, /*int nlocals,*/
286 0, /*int stacksize,*/
287 0, /*int flags,*/
288 empty_string, /*PyObject *code,*/
289 empty_tuple, /*PyObject *consts,*/
290 empty_tuple, /*PyObject *names,*/
291 empty_tuple, /*PyObject *varnames,*/
292 empty_tuple, /*PyObject *freevars,*/
293 empty_tuple, /*PyObject *cellvars,*/
294 py_srcfile, /*PyObject *filename,*/
295 py_funcname, /*PyObject *name,*/
296 __pyx_lineno, /*int firstlineno,*/
297 empty_string /*PyObject *lnotab*/
298 );
299 if (!py_code) goto bad;
300 py_frame = PyFrame_New(
301 PyThreadState_Get(), /*PyThreadState *tstate,*/
302 py_code, /*PyCodeObject *code,*/
303 py_globals, /*PyObject *globals,*/
304 0 /*PyObject *locals*/
305 );
306 if (!py_frame) goto bad;
307 py_frame->f_lineno = __pyx_lineno;
308 PyTraceBack_Here(py_frame);
309 bad:
310 Py_XDECREF(py_srcfile);
311 Py_XDECREF(py_funcname);
312 Py_XDECREF(empty_tuple);
313 Py_XDECREF(empty_string);
314 Py_XDECREF(py_code);
315 Py_XDECREF(py_frame);
316 }
OLDNEW
« no previous file with comments | « third_party/twisted_8_1/twisted/test/proto_helpers.py ('k') | third_party/twisted_8_1/twisted/test/raiser.pyx » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698