Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 184606
1
/* Generated by Cython 0.25.2 */
2
3
/* BEGIN: Cython Metadata
4
{
5
"distutils": {},
6
"module_name": "code.psage.helloworld"
7
}
8
END: Cython Metadata */
9
10
#define PY_SSIZE_T_CLEAN
11
#include "Python.h"
12
#ifndef Py_PYTHON_H
13
#error Python headers needed to compile C extensions, please install development version of Python.
14
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
15
#error Cython requires Python 2.6+ or Python 3.2+.
16
#else
17
#define CYTHON_ABI "0_25_2"
18
#include <stddef.h>
19
#ifndef offsetof
20
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
21
#endif
22
#if !defined(WIN32) && !defined(MS_WINDOWS)
23
#ifndef __stdcall
24
#define __stdcall
25
#endif
26
#ifndef __cdecl
27
#define __cdecl
28
#endif
29
#ifndef __fastcall
30
#define __fastcall
31
#endif
32
#endif
33
#ifndef DL_IMPORT
34
#define DL_IMPORT(t) t
35
#endif
36
#ifndef DL_EXPORT
37
#define DL_EXPORT(t) t
38
#endif
39
#ifndef HAVE_LONG_LONG
40
#if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000)
41
#define HAVE_LONG_LONG
42
#endif
43
#endif
44
#ifndef PY_LONG_LONG
45
#define PY_LONG_LONG LONG_LONG
46
#endif
47
#ifndef Py_HUGE_VAL
48
#define Py_HUGE_VAL HUGE_VAL
49
#endif
50
#ifdef PYPY_VERSION
51
#define CYTHON_COMPILING_IN_PYPY 1
52
#define CYTHON_COMPILING_IN_PYSTON 0
53
#define CYTHON_COMPILING_IN_CPYTHON 0
54
#undef CYTHON_USE_TYPE_SLOTS
55
#define CYTHON_USE_TYPE_SLOTS 0
56
#undef CYTHON_USE_ASYNC_SLOTS
57
#define CYTHON_USE_ASYNC_SLOTS 0
58
#undef CYTHON_USE_PYLIST_INTERNALS
59
#define CYTHON_USE_PYLIST_INTERNALS 0
60
#undef CYTHON_USE_UNICODE_INTERNALS
61
#define CYTHON_USE_UNICODE_INTERNALS 0
62
#undef CYTHON_USE_UNICODE_WRITER
63
#define CYTHON_USE_UNICODE_WRITER 0
64
#undef CYTHON_USE_PYLONG_INTERNALS
65
#define CYTHON_USE_PYLONG_INTERNALS 0
66
#undef CYTHON_AVOID_BORROWED_REFS
67
#define CYTHON_AVOID_BORROWED_REFS 1
68
#undef CYTHON_ASSUME_SAFE_MACROS
69
#define CYTHON_ASSUME_SAFE_MACROS 0
70
#undef CYTHON_UNPACK_METHODS
71
#define CYTHON_UNPACK_METHODS 0
72
#undef CYTHON_FAST_THREAD_STATE
73
#define CYTHON_FAST_THREAD_STATE 0
74
#undef CYTHON_FAST_PYCALL
75
#define CYTHON_FAST_PYCALL 0
76
#elif defined(PYSTON_VERSION)
77
#define CYTHON_COMPILING_IN_PYPY 0
78
#define CYTHON_COMPILING_IN_PYSTON 1
79
#define CYTHON_COMPILING_IN_CPYTHON 0
80
#ifndef CYTHON_USE_TYPE_SLOTS
81
#define CYTHON_USE_TYPE_SLOTS 1
82
#endif
83
#undef CYTHON_USE_ASYNC_SLOTS
84
#define CYTHON_USE_ASYNC_SLOTS 0
85
#undef CYTHON_USE_PYLIST_INTERNALS
86
#define CYTHON_USE_PYLIST_INTERNALS 0
87
#ifndef CYTHON_USE_UNICODE_INTERNALS
88
#define CYTHON_USE_UNICODE_INTERNALS 1
89
#endif
90
#undef CYTHON_USE_UNICODE_WRITER
91
#define CYTHON_USE_UNICODE_WRITER 0
92
#undef CYTHON_USE_PYLONG_INTERNALS
93
#define CYTHON_USE_PYLONG_INTERNALS 0
94
#ifndef CYTHON_AVOID_BORROWED_REFS
95
#define CYTHON_AVOID_BORROWED_REFS 0
96
#endif
97
#ifndef CYTHON_ASSUME_SAFE_MACROS
98
#define CYTHON_ASSUME_SAFE_MACROS 1
99
#endif
100
#ifndef CYTHON_UNPACK_METHODS
101
#define CYTHON_UNPACK_METHODS 1
102
#endif
103
#undef CYTHON_FAST_THREAD_STATE
104
#define CYTHON_FAST_THREAD_STATE 0
105
#undef CYTHON_FAST_PYCALL
106
#define CYTHON_FAST_PYCALL 0
107
#else
108
#define CYTHON_COMPILING_IN_PYPY 0
109
#define CYTHON_COMPILING_IN_PYSTON 0
110
#define CYTHON_COMPILING_IN_CPYTHON 1
111
#ifndef CYTHON_USE_TYPE_SLOTS
112
#define CYTHON_USE_TYPE_SLOTS 1
113
#endif
114
#if PY_MAJOR_VERSION < 3
115
#undef CYTHON_USE_ASYNC_SLOTS
116
#define CYTHON_USE_ASYNC_SLOTS 0
117
#elif !defined(CYTHON_USE_ASYNC_SLOTS)
118
#define CYTHON_USE_ASYNC_SLOTS 1
119
#endif
120
#if PY_VERSION_HEX < 0x02070000
121
#undef CYTHON_USE_PYLONG_INTERNALS
122
#define CYTHON_USE_PYLONG_INTERNALS 0
123
#elif !defined(CYTHON_USE_PYLONG_INTERNALS)
124
#define CYTHON_USE_PYLONG_INTERNALS 1
125
#endif
126
#ifndef CYTHON_USE_PYLIST_INTERNALS
127
#define CYTHON_USE_PYLIST_INTERNALS 1
128
#endif
129
#ifndef CYTHON_USE_UNICODE_INTERNALS
130
#define CYTHON_USE_UNICODE_INTERNALS 1
131
#endif
132
#if PY_VERSION_HEX < 0x030300F0
133
#undef CYTHON_USE_UNICODE_WRITER
134
#define CYTHON_USE_UNICODE_WRITER 0
135
#elif !defined(CYTHON_USE_UNICODE_WRITER)
136
#define CYTHON_USE_UNICODE_WRITER 1
137
#endif
138
#ifndef CYTHON_AVOID_BORROWED_REFS
139
#define CYTHON_AVOID_BORROWED_REFS 0
140
#endif
141
#ifndef CYTHON_ASSUME_SAFE_MACROS
142
#define CYTHON_ASSUME_SAFE_MACROS 1
143
#endif
144
#ifndef CYTHON_UNPACK_METHODS
145
#define CYTHON_UNPACK_METHODS 1
146
#endif
147
#ifndef CYTHON_FAST_THREAD_STATE
148
#define CYTHON_FAST_THREAD_STATE 1
149
#endif
150
#ifndef CYTHON_FAST_PYCALL
151
#define CYTHON_FAST_PYCALL 1
152
#endif
153
#endif
154
#if !defined(CYTHON_FAST_PYCCALL)
155
#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
156
#endif
157
#if CYTHON_USE_PYLONG_INTERNALS
158
#include "longintrepr.h"
159
#undef SHIFT
160
#undef BASE
161
#undef MASK
162
#endif
163
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
164
#define Py_OptimizeFlag 0
165
#endif
166
#define __PYX_BUILD_PY_SSIZE_T "n"
167
#define CYTHON_FORMAT_SSIZE_T "z"
168
#if PY_MAJOR_VERSION < 3
169
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
170
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
171
PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
172
#define __Pyx_DefaultClassType PyClass_Type
173
#else
174
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
175
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
176
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
177
#define __Pyx_DefaultClassType PyType_Type
178
#endif
179
#ifndef Py_TPFLAGS_CHECKTYPES
180
#define Py_TPFLAGS_CHECKTYPES 0
181
#endif
182
#ifndef Py_TPFLAGS_HAVE_INDEX
183
#define Py_TPFLAGS_HAVE_INDEX 0
184
#endif
185
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
186
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
187
#endif
188
#ifndef Py_TPFLAGS_HAVE_FINALIZE
189
#define Py_TPFLAGS_HAVE_FINALIZE 0
190
#endif
191
#ifndef METH_FASTCALL
192
#define METH_FASTCALL 0x80
193
typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args,
194
Py_ssize_t nargs, PyObject *kwnames);
195
#else
196
#define __Pyx_PyCFunctionFast _PyCFunctionFast
197
#endif
198
#if CYTHON_FAST_PYCCALL
199
#define __Pyx_PyFastCFunction_Check(func)\
200
((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)))))
201
#else
202
#define __Pyx_PyFastCFunction_Check(func) 0
203
#endif
204
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
205
#define CYTHON_PEP393_ENABLED 1
206
#define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
207
0 : _PyUnicode_Ready((PyObject *)(op)))
208
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
209
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
210
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
211
#define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
212
#define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
213
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
214
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
215
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
216
#else
217
#define CYTHON_PEP393_ENABLED 0
218
#define PyUnicode_1BYTE_KIND 1
219
#define PyUnicode_2BYTE_KIND 2
220
#define PyUnicode_4BYTE_KIND 4
221
#define __Pyx_PyUnicode_READY(op) (0)
222
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
223
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
224
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
225
#define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
226
#define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
227
#define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
228
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
229
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
230
#endif
231
#if CYTHON_COMPILING_IN_PYPY
232
#define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
233
#define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
234
#else
235
#define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
236
#define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
237
PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
238
#endif
239
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
240
#define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
241
#endif
242
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
243
#define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
244
#endif
245
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
246
#define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
247
#endif
248
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
249
#define PyObject_Malloc(s) PyMem_Malloc(s)
250
#define PyObject_Free(p) PyMem_Free(p)
251
#define PyObject_Realloc(p) PyMem_Realloc(p)
252
#endif
253
#if CYTHON_COMPILING_IN_PYSTON
254
#define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
255
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
256
#else
257
#define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
258
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
259
#endif
260
#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
261
#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
262
#if PY_MAJOR_VERSION >= 3
263
#define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
264
#else
265
#define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
266
#endif
267
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
268
#define PyObject_ASCII(o) PyObject_Repr(o)
269
#endif
270
#if PY_MAJOR_VERSION >= 3
271
#define PyBaseString_Type PyUnicode_Type
272
#define PyStringObject PyUnicodeObject
273
#define PyString_Type PyUnicode_Type
274
#define PyString_Check PyUnicode_Check
275
#define PyString_CheckExact PyUnicode_CheckExact
276
#endif
277
#if PY_MAJOR_VERSION >= 3
278
#define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
279
#define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
280
#else
281
#define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
282
#define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
283
#endif
284
#ifndef PySet_CheckExact
285
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
286
#endif
287
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
288
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
289
#if PY_MAJOR_VERSION >= 3
290
#define PyIntObject PyLongObject
291
#define PyInt_Type PyLong_Type
292
#define PyInt_Check(op) PyLong_Check(op)
293
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
294
#define PyInt_FromString PyLong_FromString
295
#define PyInt_FromUnicode PyLong_FromUnicode
296
#define PyInt_FromLong PyLong_FromLong
297
#define PyInt_FromSize_t PyLong_FromSize_t
298
#define PyInt_FromSsize_t PyLong_FromSsize_t
299
#define PyInt_AsLong PyLong_AsLong
300
#define PyInt_AS_LONG PyLong_AS_LONG
301
#define PyInt_AsSsize_t PyLong_AsSsize_t
302
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
303
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
304
#define PyNumber_Int PyNumber_Long
305
#endif
306
#if PY_MAJOR_VERSION >= 3
307
#define PyBoolObject PyLongObject
308
#endif
309
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
310
#ifndef PyUnicode_InternFromString
311
#define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
312
#endif
313
#endif
314
#if PY_VERSION_HEX < 0x030200A4
315
typedef long Py_hash_t;
316
#define __Pyx_PyInt_FromHash_t PyInt_FromLong
317
#define __Pyx_PyInt_AsHash_t PyInt_AsLong
318
#else
319
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
320
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
321
#endif
322
#if PY_MAJOR_VERSION >= 3
323
#define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
324
#else
325
#define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
326
#endif
327
#if CYTHON_USE_ASYNC_SLOTS
328
#if PY_VERSION_HEX >= 0x030500B1
329
#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
330
#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
331
#else
332
typedef struct {
333
unaryfunc am_await;
334
unaryfunc am_aiter;
335
unaryfunc am_anext;
336
} __Pyx_PyAsyncMethodsStruct;
337
#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
338
#endif
339
#else
340
#define __Pyx_PyType_AsAsync(obj) NULL
341
#endif
342
#ifndef CYTHON_RESTRICT
343
#if defined(__GNUC__)
344
#define CYTHON_RESTRICT __restrict__
345
#elif defined(_MSC_VER) && _MSC_VER >= 1400
346
#define CYTHON_RESTRICT __restrict
347
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
348
#define CYTHON_RESTRICT restrict
349
#else
350
#define CYTHON_RESTRICT
351
#endif
352
#endif
353
#ifndef CYTHON_UNUSED
354
# if defined(__GNUC__)
355
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
356
# define CYTHON_UNUSED __attribute__ ((__unused__))
357
# else
358
# define CYTHON_UNUSED
359
# endif
360
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
361
# define CYTHON_UNUSED __attribute__ ((__unused__))
362
# else
363
# define CYTHON_UNUSED
364
# endif
365
#endif
366
#ifndef CYTHON_MAYBE_UNUSED_VAR
367
# if defined(__cplusplus)
368
template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
369
# else
370
# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
371
# endif
372
#endif
373
#ifndef CYTHON_NCP_UNUSED
374
# if CYTHON_COMPILING_IN_CPYTHON
375
# define CYTHON_NCP_UNUSED
376
# else
377
# define CYTHON_NCP_UNUSED CYTHON_UNUSED
378
# endif
379
#endif
380
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
381
382
#ifndef CYTHON_INLINE
383
#if defined(__clang__)
384
#define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
385
#elif defined(__GNUC__)
386
#define CYTHON_INLINE __inline__
387
#elif defined(_MSC_VER)
388
#define CYTHON_INLINE __inline
389
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
390
#define CYTHON_INLINE inline
391
#else
392
#define CYTHON_INLINE
393
#endif
394
#endif
395
396
#if defined(WIN32) || defined(MS_WINDOWS)
397
#define _USE_MATH_DEFINES
398
#endif
399
#include <math.h>
400
#ifdef NAN
401
#define __PYX_NAN() ((float) NAN)
402
#else
403
static CYTHON_INLINE float __PYX_NAN() {
404
float value;
405
memset(&value, 0xFF, sizeof(value));
406
return value;
407
}
408
#endif
409
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
410
#define __Pyx_truncl trunc
411
#else
412
#define __Pyx_truncl truncl
413
#endif
414
415
416
#define __PYX_ERR(f_index, lineno, Ln_error) \
417
{ \
418
__pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
419
}
420
421
#if PY_MAJOR_VERSION >= 3
422
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
423
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
424
#else
425
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
426
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
427
#endif
428
429
#ifndef __PYX_EXTERN_C
430
#ifdef __cplusplus
431
#define __PYX_EXTERN_C extern "C"
432
#else
433
#define __PYX_EXTERN_C extern
434
#endif
435
#endif
436
437
#define __PYX_HAVE__code__psage__helloworld
438
#define __PYX_HAVE_API__code__psage__helloworld
439
#ifdef _OPENMP
440
#include <omp.h>
441
#endif /* _OPENMP */
442
443
#ifdef PYREX_WITHOUT_ASSERTIONS
444
#define CYTHON_WITHOUT_ASSERTIONS
445
#endif
446
447
typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
448
const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
449
450
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
451
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
452
#define __PYX_DEFAULT_STRING_ENCODING ""
453
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
454
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
455
#define __Pyx_uchar_cast(c) ((unsigned char)c)
456
#define __Pyx_long_cast(x) ((long)x)
457
#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
458
(sizeof(type) < sizeof(Py_ssize_t)) ||\
459
(sizeof(type) > sizeof(Py_ssize_t) &&\
460
likely(v < (type)PY_SSIZE_T_MAX ||\
461
v == (type)PY_SSIZE_T_MAX) &&\
462
(!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
463
v == (type)PY_SSIZE_T_MIN))) ||\
464
(sizeof(type) == sizeof(Py_ssize_t) &&\
465
(is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
466
v == (type)PY_SSIZE_T_MAX))) )
467
#if defined (__cplusplus) && __cplusplus >= 201103L
468
#include <cstdlib>
469
#define __Pyx_sst_abs(value) std::abs(value)
470
#elif SIZEOF_INT >= SIZEOF_SIZE_T
471
#define __Pyx_sst_abs(value) abs(value)
472
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
473
#define __Pyx_sst_abs(value) labs(value)
474
#elif defined (_MSC_VER) && defined (_M_X64)
475
#define __Pyx_sst_abs(value) _abs64(value)
476
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
477
#define __Pyx_sst_abs(value) llabs(value)
478
#elif defined (__GNUC__)
479
#define __Pyx_sst_abs(value) __builtin_llabs(value)
480
#else
481
#define __Pyx_sst_abs(value) ((value<0) ? -value : value)
482
#endif
483
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
484
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
485
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
486
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
487
#define __Pyx_PyBytes_FromString PyBytes_FromString
488
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
489
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
490
#if PY_MAJOR_VERSION < 3
491
#define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
492
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
493
#else
494
#define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
495
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
496
#endif
497
#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
498
#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
499
#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
500
#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
501
#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
502
#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
503
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
504
#if PY_MAJOR_VERSION < 3
505
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
506
{
507
const Py_UNICODE *u_end = u;
508
while (*u_end++) ;
509
return (size_t)(u_end - u - 1);
510
}
511
#else
512
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
513
#endif
514
#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
515
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
516
#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
517
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
518
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
519
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
520
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
521
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
522
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
523
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
524
#if CYTHON_ASSUME_SAFE_MACROS
525
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
526
#else
527
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
528
#endif
529
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
530
#if PY_MAJOR_VERSION >= 3
531
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
532
#else
533
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
534
#endif
535
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
536
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
537
static int __Pyx_sys_getdefaultencoding_not_ascii;
538
static int __Pyx_init_sys_getdefaultencoding_params(void) {
539
PyObject* sys;
540
PyObject* default_encoding = NULL;
541
PyObject* ascii_chars_u = NULL;
542
PyObject* ascii_chars_b = NULL;
543
const char* default_encoding_c;
544
sys = PyImport_ImportModule("sys");
545
if (!sys) goto bad;
546
default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
547
Py_DECREF(sys);
548
if (!default_encoding) goto bad;
549
default_encoding_c = PyBytes_AsString(default_encoding);
550
if (!default_encoding_c) goto bad;
551
if (strcmp(default_encoding_c, "ascii") == 0) {
552
__Pyx_sys_getdefaultencoding_not_ascii = 0;
553
} else {
554
char ascii_chars[128];
555
int c;
556
for (c = 0; c < 128; c++) {
557
ascii_chars[c] = c;
558
}
559
__Pyx_sys_getdefaultencoding_not_ascii = 1;
560
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
561
if (!ascii_chars_u) goto bad;
562
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
563
if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
564
PyErr_Format(
565
PyExc_ValueError,
566
"This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
567
default_encoding_c);
568
goto bad;
569
}
570
Py_DECREF(ascii_chars_u);
571
Py_DECREF(ascii_chars_b);
572
}
573
Py_DECREF(default_encoding);
574
return 0;
575
bad:
576
Py_XDECREF(default_encoding);
577
Py_XDECREF(ascii_chars_u);
578
Py_XDECREF(ascii_chars_b);
579
return -1;
580
}
581
#endif
582
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
583
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
584
#else
585
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
586
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
587
static char* __PYX_DEFAULT_STRING_ENCODING;
588
static int __Pyx_init_sys_getdefaultencoding_params(void) {
589
PyObject* sys;
590
PyObject* default_encoding = NULL;
591
char* default_encoding_c;
592
sys = PyImport_ImportModule("sys");
593
if (!sys) goto bad;
594
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
595
Py_DECREF(sys);
596
if (!default_encoding) goto bad;
597
default_encoding_c = PyBytes_AsString(default_encoding);
598
if (!default_encoding_c) goto bad;
599
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
600
if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
601
strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
602
Py_DECREF(default_encoding);
603
return 0;
604
bad:
605
Py_XDECREF(default_encoding);
606
return -1;
607
}
608
#endif
609
#endif
610
611
612
/* Test for GCC > 2.95 */
613
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
614
#define likely(x) __builtin_expect(!!(x), 1)
615
#define unlikely(x) __builtin_expect(!!(x), 0)
616
#else /* !__GNUC__ or GCC < 2.95 */
617
#define likely(x) (x)
618
#define unlikely(x) (x)
619
#endif /* __GNUC__ */
620
621
static PyObject *__pyx_m;
622
static PyObject *__pyx_d;
623
static PyObject *__pyx_b;
624
static PyObject *__pyx_empty_tuple;
625
static PyObject *__pyx_empty_bytes;
626
static PyObject *__pyx_empty_unicode;
627
static int __pyx_lineno;
628
static int __pyx_clineno = 0;
629
static const char * __pyx_cfilenm= __FILE__;
630
static const char *__pyx_filename;
631
632
633
static const char *__pyx_f[] = {
634
"code/psage/helloworld.pyx",
635
};
636
637
/*--- Type declarations ---*/
638
639
/* --- Runtime support code (head) --- */
640
/* Refnanny.proto */
641
#ifndef CYTHON_REFNANNY
642
#define CYTHON_REFNANNY 0
643
#endif
644
#if CYTHON_REFNANNY
645
typedef struct {
646
void (*INCREF)(void*, PyObject*, int);
647
void (*DECREF)(void*, PyObject*, int);
648
void (*GOTREF)(void*, PyObject*, int);
649
void (*GIVEREF)(void*, PyObject*, int);
650
void* (*SetupContext)(const char*, int, const char*);
651
void (*FinishContext)(void**);
652
} __Pyx_RefNannyAPIStruct;
653
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
654
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
655
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
656
#ifdef WITH_THREAD
657
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
658
if (acquire_gil) {\
659
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
660
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
661
PyGILState_Release(__pyx_gilstate_save);\
662
} else {\
663
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
664
}
665
#else
666
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
667
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
668
#endif
669
#define __Pyx_RefNannyFinishContext()\
670
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
671
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
672
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
673
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
674
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
675
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
676
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
677
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
678
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
679
#else
680
#define __Pyx_RefNannyDeclarations
681
#define __Pyx_RefNannySetupContext(name, acquire_gil)
682
#define __Pyx_RefNannyFinishContext()
683
#define __Pyx_INCREF(r) Py_INCREF(r)
684
#define __Pyx_DECREF(r) Py_DECREF(r)
685
#define __Pyx_GOTREF(r)
686
#define __Pyx_GIVEREF(r)
687
#define __Pyx_XINCREF(r) Py_XINCREF(r)
688
#define __Pyx_XDECREF(r) Py_XDECREF(r)
689
#define __Pyx_XGOTREF(r)
690
#define __Pyx_XGIVEREF(r)
691
#endif
692
#define __Pyx_XDECREF_SET(r, v) do {\
693
PyObject *tmp = (PyObject *) r;\
694
r = v; __Pyx_XDECREF(tmp);\
695
} while (0)
696
#define __Pyx_DECREF_SET(r, v) do {\
697
PyObject *tmp = (PyObject *) r;\
698
r = v; __Pyx_DECREF(tmp);\
699
} while (0)
700
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
701
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
702
703
/* CodeObjectCache.proto */
704
typedef struct {
705
PyCodeObject* code_object;
706
int code_line;
707
} __Pyx_CodeObjectCacheEntry;
708
struct __Pyx_CodeObjectCache {
709
int count;
710
int max_count;
711
__Pyx_CodeObjectCacheEntry* entries;
712
};
713
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
714
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
715
static PyCodeObject *__pyx_find_code_object(int code_line);
716
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
717
718
/* AddTraceback.proto */
719
static void __Pyx_AddTraceback(const char *funcname, int c_line,
720
int py_line, const char *filename);
721
722
/* Print.proto */
723
static int __Pyx_Print(PyObject*, PyObject *, int);
724
#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
725
static PyObject* __pyx_print = 0;
726
static PyObject* __pyx_print_kwargs = 0;
727
#endif
728
729
/* PrintOne.proto */
730
static int __Pyx_PrintOne(PyObject* stream, PyObject *o);
731
732
/* CIntToPy.proto */
733
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
734
735
/* CIntFromPy.proto */
736
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
737
738
/* CIntFromPy.proto */
739
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
740
741
/* CheckBinaryVersion.proto */
742
static int __Pyx_check_binary_version(void);
743
744
/* InitStrings.proto */
745
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
746
747
748
/* Module declarations from 'code.psage.helloworld' */
749
#define __Pyx_MODULE_NAME "code.psage.helloworld"
750
int __pyx_module_is_main_code__psage__helloworld = 0;
751
752
/* Implementation of 'code.psage.helloworld' */
753
static const char __pyx_k_end[] = "end";
754
static const char __pyx_k_file[] = "file";
755
static const char __pyx_k_main[] = "__main__";
756
static const char __pyx_k_test[] = "__test__";
757
static const char __pyx_k_print[] = "print";
758
static const char __pyx_k_Hello_World[] = "Hello World";
759
static PyObject *__pyx_kp_s_Hello_World;
760
static PyObject *__pyx_n_s_end;
761
static PyObject *__pyx_n_s_file;
762
static PyObject *__pyx_n_s_main;
763
static PyObject *__pyx_n_s_print;
764
static PyObject *__pyx_n_s_test;
765
766
static PyMethodDef __pyx_methods[] = {
767
{0, 0, 0, 0}
768
};
769
770
#if PY_MAJOR_VERSION >= 3
771
static struct PyModuleDef __pyx_moduledef = {
772
#if PY_VERSION_HEX < 0x03020000
773
{ PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
774
#else
775
PyModuleDef_HEAD_INIT,
776
#endif
777
"helloworld",
778
0, /* m_doc */
779
-1, /* m_size */
780
__pyx_methods /* m_methods */,
781
NULL, /* m_reload */
782
NULL, /* m_traverse */
783
NULL, /* m_clear */
784
NULL /* m_free */
785
};
786
#endif
787
788
static __Pyx_StringTabEntry __pyx_string_tab[] = {
789
{&__pyx_kp_s_Hello_World, __pyx_k_Hello_World, sizeof(__pyx_k_Hello_World), 0, 0, 1, 0},
790
{&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
791
{&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
792
{&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
793
{&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
794
{&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
795
{0, 0, 0, 0, 0, 0, 0}
796
};
797
static int __Pyx_InitCachedBuiltins(void) {
798
return 0;
799
}
800
801
static int __Pyx_InitCachedConstants(void) {
802
__Pyx_RefNannyDeclarations
803
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
804
__Pyx_RefNannyFinishContext();
805
return 0;
806
}
807
808
static int __Pyx_InitGlobals(void) {
809
if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
810
return 0;
811
__pyx_L1_error:;
812
return -1;
813
}
814
815
#if PY_MAJOR_VERSION < 3
816
PyMODINIT_FUNC inithelloworld(void); /*proto*/
817
PyMODINIT_FUNC inithelloworld(void)
818
#else
819
PyMODINIT_FUNC PyInit_helloworld(void); /*proto*/
820
PyMODINIT_FUNC PyInit_helloworld(void)
821
#endif
822
{
823
PyObject *__pyx_t_1 = NULL;
824
__Pyx_RefNannyDeclarations
825
#if CYTHON_REFNANNY
826
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
827
if (!__Pyx_RefNanny) {
828
PyErr_Clear();
829
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
830
if (!__Pyx_RefNanny)
831
Py_FatalError("failed to import 'refnanny' module");
832
}
833
#endif
834
__Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_helloworld(void)", 0);
835
if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
836
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
837
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
838
__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
839
#ifdef __Pyx_CyFunction_USED
840
if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
841
#endif
842
#ifdef __Pyx_FusedFunction_USED
843
if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
844
#endif
845
#ifdef __Pyx_Coroutine_USED
846
if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
847
#endif
848
#ifdef __Pyx_Generator_USED
849
if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
850
#endif
851
#ifdef __Pyx_StopAsyncIteration_USED
852
if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
853
#endif
854
/*--- Library function declarations ---*/
855
/*--- Threads initialization code ---*/
856
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
857
#ifdef WITH_THREAD /* Python build with threading support? */
858
PyEval_InitThreads();
859
#endif
860
#endif
861
/*--- Module creation code ---*/
862
#if PY_MAJOR_VERSION < 3
863
__pyx_m = Py_InitModule4("helloworld", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
864
#else
865
__pyx_m = PyModule_Create(&__pyx_moduledef);
866
#endif
867
if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
868
__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
869
Py_INCREF(__pyx_d);
870
__pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
871
#if CYTHON_COMPILING_IN_PYPY
872
Py_INCREF(__pyx_b);
873
#endif
874
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
875
/*--- Initialize various global constants etc. ---*/
876
if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
877
#if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
878
if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
879
#endif
880
if (__pyx_module_is_main_code__psage__helloworld) {
881
if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
882
}
883
#if PY_MAJOR_VERSION >= 3
884
{
885
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
886
if (!PyDict_GetItemString(modules, "code.psage.helloworld")) {
887
if (unlikely(PyDict_SetItemString(modules, "code.psage.helloworld", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
888
}
889
}
890
#endif
891
/*--- Builtin init code ---*/
892
if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
893
/*--- Constants init code ---*/
894
if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
895
/*--- Global init code ---*/
896
/*--- Variable export code ---*/
897
/*--- Function export code ---*/
898
/*--- Type init code ---*/
899
/*--- Type import code ---*/
900
/*--- Variable import code ---*/
901
/*--- Function import code ---*/
902
/*--- Execution code ---*/
903
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
904
if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
905
#endif
906
907
/* "code/psage/helloworld.pyx":1
908
* print "Hello World" # <<<<<<<<<<<<<<
909
*/
910
if (__Pyx_PrintOne(0, __pyx_kp_s_Hello_World) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
911
__pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
912
__Pyx_GOTREF(__pyx_t_1);
913
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
914
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
915
916
/*--- Wrapped vars code ---*/
917
918
goto __pyx_L0;
919
__pyx_L1_error:;
920
__Pyx_XDECREF(__pyx_t_1);
921
if (__pyx_m) {
922
if (__pyx_d) {
923
__Pyx_AddTraceback("init code.psage.helloworld", __pyx_clineno, __pyx_lineno, __pyx_filename);
924
}
925
Py_DECREF(__pyx_m); __pyx_m = 0;
926
} else if (!PyErr_Occurred()) {
927
PyErr_SetString(PyExc_ImportError, "init code.psage.helloworld");
928
}
929
__pyx_L0:;
930
__Pyx_RefNannyFinishContext();
931
#if PY_MAJOR_VERSION < 3
932
return;
933
#else
934
return __pyx_m;
935
#endif
936
}
937
938
/* --- Runtime support code --- */
939
/* Refnanny */
940
#if CYTHON_REFNANNY
941
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
942
PyObject *m = NULL, *p = NULL;
943
void *r = NULL;
944
m = PyImport_ImportModule((char *)modname);
945
if (!m) goto end;
946
p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
947
if (!p) goto end;
948
r = PyLong_AsVoidPtr(p);
949
end:
950
Py_XDECREF(p);
951
Py_XDECREF(m);
952
return (__Pyx_RefNannyAPIStruct *)r;
953
}
954
#endif
955
956
/* CodeObjectCache */
957
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
958
int start = 0, mid = 0, end = count - 1;
959
if (end >= 0 && code_line > entries[end].code_line) {
960
return count;
961
}
962
while (start < end) {
963
mid = start + (end - start) / 2;
964
if (code_line < entries[mid].code_line) {
965
end = mid;
966
} else if (code_line > entries[mid].code_line) {
967
start = mid + 1;
968
} else {
969
return mid;
970
}
971
}
972
if (code_line <= entries[mid].code_line) {
973
return mid;
974
} else {
975
return mid + 1;
976
}
977
}
978
static PyCodeObject *__pyx_find_code_object(int code_line) {
979
PyCodeObject* code_object;
980
int pos;
981
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
982
return NULL;
983
}
984
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
985
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
986
return NULL;
987
}
988
code_object = __pyx_code_cache.entries[pos].code_object;
989
Py_INCREF(code_object);
990
return code_object;
991
}
992
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
993
int pos, i;
994
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
995
if (unlikely(!code_line)) {
996
return;
997
}
998
if (unlikely(!entries)) {
999
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
1000
if (likely(entries)) {
1001
__pyx_code_cache.entries = entries;
1002
__pyx_code_cache.max_count = 64;
1003
__pyx_code_cache.count = 1;
1004
entries[0].code_line = code_line;
1005
entries[0].code_object = code_object;
1006
Py_INCREF(code_object);
1007
}
1008
return;
1009
}
1010
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
1011
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
1012
PyCodeObject* tmp = entries[pos].code_object;
1013
entries[pos].code_object = code_object;
1014
Py_DECREF(tmp);
1015
return;
1016
}
1017
if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
1018
int new_max = __pyx_code_cache.max_count + 64;
1019
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
1020
__pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
1021
if (unlikely(!entries)) {
1022
return;
1023
}
1024
__pyx_code_cache.entries = entries;
1025
__pyx_code_cache.max_count = new_max;
1026
}
1027
for (i=__pyx_code_cache.count; i>pos; i--) {
1028
entries[i] = entries[i-1];
1029
}
1030
entries[pos].code_line = code_line;
1031
entries[pos].code_object = code_object;
1032
__pyx_code_cache.count++;
1033
Py_INCREF(code_object);
1034
}
1035
1036
/* AddTraceback */
1037
#include "compile.h"
1038
#include "frameobject.h"
1039
#include "traceback.h"
1040
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
1041
const char *funcname, int c_line,
1042
int py_line, const char *filename) {
1043
PyCodeObject *py_code = 0;
1044
PyObject *py_srcfile = 0;
1045
PyObject *py_funcname = 0;
1046
#if PY_MAJOR_VERSION < 3
1047
py_srcfile = PyString_FromString(filename);
1048
#else
1049
py_srcfile = PyUnicode_FromString(filename);
1050
#endif
1051
if (!py_srcfile) goto bad;
1052
if (c_line) {
1053
#if PY_MAJOR_VERSION < 3
1054
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
1055
#else
1056
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
1057
#endif
1058
}
1059
else {
1060
#if PY_MAJOR_VERSION < 3
1061
py_funcname = PyString_FromString(funcname);
1062
#else
1063
py_funcname = PyUnicode_FromString(funcname);
1064
#endif
1065
}
1066
if (!py_funcname) goto bad;
1067
py_code = __Pyx_PyCode_New(
1068
0,
1069
0,
1070
0,
1071
0,
1072
0,
1073
__pyx_empty_bytes, /*PyObject *code,*/
1074
__pyx_empty_tuple, /*PyObject *consts,*/
1075
__pyx_empty_tuple, /*PyObject *names,*/
1076
__pyx_empty_tuple, /*PyObject *varnames,*/
1077
__pyx_empty_tuple, /*PyObject *freevars,*/
1078
__pyx_empty_tuple, /*PyObject *cellvars,*/
1079
py_srcfile, /*PyObject *filename,*/
1080
py_funcname, /*PyObject *name,*/
1081
py_line,
1082
__pyx_empty_bytes /*PyObject *lnotab*/
1083
);
1084
Py_DECREF(py_srcfile);
1085
Py_DECREF(py_funcname);
1086
return py_code;
1087
bad:
1088
Py_XDECREF(py_srcfile);
1089
Py_XDECREF(py_funcname);
1090
return NULL;
1091
}
1092
static void __Pyx_AddTraceback(const char *funcname, int c_line,
1093
int py_line, const char *filename) {
1094
PyCodeObject *py_code = 0;
1095
PyFrameObject *py_frame = 0;
1096
py_code = __pyx_find_code_object(c_line ? c_line : py_line);
1097
if (!py_code) {
1098
py_code = __Pyx_CreateCodeObjectForTraceback(
1099
funcname, c_line, py_line, filename);
1100
if (!py_code) goto bad;
1101
__pyx_insert_code_object(c_line ? c_line : py_line, py_code);
1102
}
1103
py_frame = PyFrame_New(
1104
PyThreadState_GET(), /*PyThreadState *tstate,*/
1105
py_code, /*PyCodeObject *code,*/
1106
__pyx_d, /*PyObject *globals,*/
1107
0 /*PyObject *locals*/
1108
);
1109
if (!py_frame) goto bad;
1110
__Pyx_PyFrame_SetLineNumber(py_frame, py_line);
1111
PyTraceBack_Here(py_frame);
1112
bad:
1113
Py_XDECREF(py_code);
1114
Py_XDECREF(py_frame);
1115
}
1116
1117
/* Print */
1118
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
1119
static PyObject *__Pyx_GetStdout(void) {
1120
PyObject *f = PySys_GetObject((char *)"stdout");
1121
if (!f) {
1122
PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
1123
}
1124
return f;
1125
}
1126
static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
1127
int i;
1128
if (!f) {
1129
if (!(f = __Pyx_GetStdout()))
1130
return -1;
1131
}
1132
Py_INCREF(f);
1133
for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
1134
PyObject* v;
1135
if (PyFile_SoftSpace(f, 1)) {
1136
if (PyFile_WriteString(" ", f) < 0)
1137
goto error;
1138
}
1139
v = PyTuple_GET_ITEM(arg_tuple, i);
1140
if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
1141
goto error;
1142
if (PyString_Check(v)) {
1143
char *s = PyString_AsString(v);
1144
Py_ssize_t len = PyString_Size(v);
1145
if (len > 0) {
1146
switch (s[len-1]) {
1147
case ' ': break;
1148
case '\f': case '\r': case '\n': case '\t': case '\v':
1149
PyFile_SoftSpace(f, 0);
1150
break;
1151
default: break;
1152
}
1153
}
1154
}
1155
}
1156
if (newline) {
1157
if (PyFile_WriteString("\n", f) < 0)
1158
goto error;
1159
PyFile_SoftSpace(f, 0);
1160
}
1161
Py_DECREF(f);
1162
return 0;
1163
error:
1164
Py_DECREF(f);
1165
return -1;
1166
}
1167
#else
1168
static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
1169
PyObject* kwargs = 0;
1170
PyObject* result = 0;
1171
PyObject* end_string;
1172
if (unlikely(!__pyx_print)) {
1173
__pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print);
1174
if (!__pyx_print)
1175
return -1;
1176
}
1177
if (stream) {
1178
kwargs = PyDict_New();
1179
if (unlikely(!kwargs))
1180
return -1;
1181
if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0))
1182
goto bad;
1183
if (!newline) {
1184
end_string = PyUnicode_FromStringAndSize(" ", 1);
1185
if (unlikely(!end_string))
1186
goto bad;
1187
if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) {
1188
Py_DECREF(end_string);
1189
goto bad;
1190
}
1191
Py_DECREF(end_string);
1192
}
1193
} else if (!newline) {
1194
if (unlikely(!__pyx_print_kwargs)) {
1195
__pyx_print_kwargs = PyDict_New();
1196
if (unlikely(!__pyx_print_kwargs))
1197
return -1;
1198
end_string = PyUnicode_FromStringAndSize(" ", 1);
1199
if (unlikely(!end_string))
1200
return -1;
1201
if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) {
1202
Py_DECREF(end_string);
1203
return -1;
1204
}
1205
Py_DECREF(end_string);
1206
}
1207
kwargs = __pyx_print_kwargs;
1208
}
1209
result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
1210
if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
1211
Py_DECREF(kwargs);
1212
if (!result)
1213
return -1;
1214
Py_DECREF(result);
1215
return 0;
1216
bad:
1217
if (kwargs != __pyx_print_kwargs)
1218
Py_XDECREF(kwargs);
1219
return -1;
1220
}
1221
#endif
1222
1223
/* PrintOne */
1224
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
1225
static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
1226
if (!f) {
1227
if (!(f = __Pyx_GetStdout()))
1228
return -1;
1229
}
1230
Py_INCREF(f);
1231
if (PyFile_SoftSpace(f, 0)) {
1232
if (PyFile_WriteString(" ", f) < 0)
1233
goto error;
1234
}
1235
if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
1236
goto error;
1237
if (PyFile_WriteString("\n", f) < 0)
1238
goto error;
1239
Py_DECREF(f);
1240
return 0;
1241
error:
1242
Py_DECREF(f);
1243
return -1;
1244
/* the line below is just to avoid C compiler
1245
* warnings about unused functions */
1246
return __Pyx_Print(f, NULL, 0);
1247
}
1248
#else
1249
static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
1250
int res;
1251
PyObject* arg_tuple = PyTuple_Pack(1, o);
1252
if (unlikely(!arg_tuple))
1253
return -1;
1254
res = __Pyx_Print(stream, arg_tuple, 1);
1255
Py_DECREF(arg_tuple);
1256
return res;
1257
}
1258
#endif
1259
1260
/* CIntToPy */
1261
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
1262
const long neg_one = (long) -1, const_zero = (long) 0;
1263
const int is_unsigned = neg_one > const_zero;
1264
if (is_unsigned) {
1265
if (sizeof(long) < sizeof(long)) {
1266
return PyInt_FromLong((long) value);
1267
} else if (sizeof(long) <= sizeof(unsigned long)) {
1268
return PyLong_FromUnsignedLong((unsigned long) value);
1269
#ifdef HAVE_LONG_LONG
1270
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
1271
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
1272
#endif
1273
}
1274
} else {
1275
if (sizeof(long) <= sizeof(long)) {
1276
return PyInt_FromLong((long) value);
1277
#ifdef HAVE_LONG_LONG
1278
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
1279
return PyLong_FromLongLong((PY_LONG_LONG) value);
1280
#endif
1281
}
1282
}
1283
{
1284
int one = 1; int little = (int)*(unsigned char *)&one;
1285
unsigned char *bytes = (unsigned char *)&value;
1286
return _PyLong_FromByteArray(bytes, sizeof(long),
1287
little, !is_unsigned);
1288
}
1289
}
1290
1291
/* CIntFromPyVerify */
1292
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
1293
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
1294
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
1295
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
1296
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
1297
{\
1298
func_type value = func_value;\
1299
if (sizeof(target_type) < sizeof(func_type)) {\
1300
if (unlikely(value != (func_type) (target_type) value)) {\
1301
func_type zero = 0;\
1302
if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
1303
return (target_type) -1;\
1304
if (is_unsigned && unlikely(value < zero))\
1305
goto raise_neg_overflow;\
1306
else\
1307
goto raise_overflow;\
1308
}\
1309
}\
1310
return (target_type) value;\
1311
}
1312
1313
/* CIntFromPy */
1314
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
1315
const long neg_one = (long) -1, const_zero = (long) 0;
1316
const int is_unsigned = neg_one > const_zero;
1317
#if PY_MAJOR_VERSION < 3
1318
if (likely(PyInt_Check(x))) {
1319
if (sizeof(long) < sizeof(long)) {
1320
__PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
1321
} else {
1322
long val = PyInt_AS_LONG(x);
1323
if (is_unsigned && unlikely(val < 0)) {
1324
goto raise_neg_overflow;
1325
}
1326
return (long) val;
1327
}
1328
} else
1329
#endif
1330
if (likely(PyLong_Check(x))) {
1331
if (is_unsigned) {
1332
#if CYTHON_USE_PYLONG_INTERNALS
1333
const digit* digits = ((PyLongObject*)x)->ob_digit;
1334
switch (Py_SIZE(x)) {
1335
case 0: return (long) 0;
1336
case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
1337
case 2:
1338
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
1339
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
1340
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1341
} else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
1342
return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
1343
}
1344
}
1345
break;
1346
case 3:
1347
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
1348
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
1349
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1350
} else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
1351
return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
1352
}
1353
}
1354
break;
1355
case 4:
1356
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
1357
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
1358
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1359
} else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
1360
return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
1361
}
1362
}
1363
break;
1364
}
1365
#endif
1366
#if CYTHON_COMPILING_IN_CPYTHON
1367
if (unlikely(Py_SIZE(x) < 0)) {
1368
goto raise_neg_overflow;
1369
}
1370
#else
1371
{
1372
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
1373
if (unlikely(result < 0))
1374
return (long) -1;
1375
if (unlikely(result == 1))
1376
goto raise_neg_overflow;
1377
}
1378
#endif
1379
if (sizeof(long) <= sizeof(unsigned long)) {
1380
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
1381
#ifdef HAVE_LONG_LONG
1382
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
1383
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
1384
#endif
1385
}
1386
} else {
1387
#if CYTHON_USE_PYLONG_INTERNALS
1388
const digit* digits = ((PyLongObject*)x)->ob_digit;
1389
switch (Py_SIZE(x)) {
1390
case 0: return (long) 0;
1391
case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
1392
case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
1393
case -2:
1394
if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
1395
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
1396
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1397
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
1398
return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
1399
}
1400
}
1401
break;
1402
case 2:
1403
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
1404
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
1405
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1406
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
1407
return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
1408
}
1409
}
1410
break;
1411
case -3:
1412
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
1413
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
1414
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1415
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
1416
return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
1417
}
1418
}
1419
break;
1420
case 3:
1421
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
1422
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
1423
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1424
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
1425
return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
1426
}
1427
}
1428
break;
1429
case -4:
1430
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
1431
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
1432
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1433
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
1434
return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
1435
}
1436
}
1437
break;
1438
case 4:
1439
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
1440
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
1441
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1442
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
1443
return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
1444
}
1445
}
1446
break;
1447
}
1448
#endif
1449
if (sizeof(long) <= sizeof(long)) {
1450
__PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
1451
#ifdef HAVE_LONG_LONG
1452
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
1453
__PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
1454
#endif
1455
}
1456
}
1457
{
1458
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
1459
PyErr_SetString(PyExc_RuntimeError,
1460
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
1461
#else
1462
long val;
1463
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
1464
#if PY_MAJOR_VERSION < 3
1465
if (likely(v) && !PyLong_Check(v)) {
1466
PyObject *tmp = v;
1467
v = PyNumber_Long(tmp);
1468
Py_DECREF(tmp);
1469
}
1470
#endif
1471
if (likely(v)) {
1472
int one = 1; int is_little = (int)*(unsigned char *)&one;
1473
unsigned char *bytes = (unsigned char *)&val;
1474
int ret = _PyLong_AsByteArray((PyLongObject *)v,
1475
bytes, sizeof(val),
1476
is_little, !is_unsigned);
1477
Py_DECREF(v);
1478
if (likely(!ret))
1479
return val;
1480
}
1481
#endif
1482
return (long) -1;
1483
}
1484
} else {
1485
long val;
1486
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
1487
if (!tmp) return (long) -1;
1488
val = __Pyx_PyInt_As_long(tmp);
1489
Py_DECREF(tmp);
1490
return val;
1491
}
1492
raise_overflow:
1493
PyErr_SetString(PyExc_OverflowError,
1494
"value too large to convert to long");
1495
return (long) -1;
1496
raise_neg_overflow:
1497
PyErr_SetString(PyExc_OverflowError,
1498
"can't convert negative value to long");
1499
return (long) -1;
1500
}
1501
1502
/* CIntFromPy */
1503
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
1504
const int neg_one = (int) -1, const_zero = (int) 0;
1505
const int is_unsigned = neg_one > const_zero;
1506
#if PY_MAJOR_VERSION < 3
1507
if (likely(PyInt_Check(x))) {
1508
if (sizeof(int) < sizeof(long)) {
1509
__PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
1510
} else {
1511
long val = PyInt_AS_LONG(x);
1512
if (is_unsigned && unlikely(val < 0)) {
1513
goto raise_neg_overflow;
1514
}
1515
return (int) val;
1516
}
1517
} else
1518
#endif
1519
if (likely(PyLong_Check(x))) {
1520
if (is_unsigned) {
1521
#if CYTHON_USE_PYLONG_INTERNALS
1522
const digit* digits = ((PyLongObject*)x)->ob_digit;
1523
switch (Py_SIZE(x)) {
1524
case 0: return (int) 0;
1525
case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
1526
case 2:
1527
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
1528
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
1529
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1530
} else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
1531
return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
1532
}
1533
}
1534
break;
1535
case 3:
1536
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
1537
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
1538
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1539
} else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
1540
return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
1541
}
1542
}
1543
break;
1544
case 4:
1545
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
1546
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
1547
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1548
} else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
1549
return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
1550
}
1551
}
1552
break;
1553
}
1554
#endif
1555
#if CYTHON_COMPILING_IN_CPYTHON
1556
if (unlikely(Py_SIZE(x) < 0)) {
1557
goto raise_neg_overflow;
1558
}
1559
#else
1560
{
1561
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
1562
if (unlikely(result < 0))
1563
return (int) -1;
1564
if (unlikely(result == 1))
1565
goto raise_neg_overflow;
1566
}
1567
#endif
1568
if (sizeof(int) <= sizeof(unsigned long)) {
1569
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
1570
#ifdef HAVE_LONG_LONG
1571
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
1572
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
1573
#endif
1574
}
1575
} else {
1576
#if CYTHON_USE_PYLONG_INTERNALS
1577
const digit* digits = ((PyLongObject*)x)->ob_digit;
1578
switch (Py_SIZE(x)) {
1579
case 0: return (int) 0;
1580
case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
1581
case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
1582
case -2:
1583
if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
1584
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
1585
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1586
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
1587
return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
1588
}
1589
}
1590
break;
1591
case 2:
1592
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
1593
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
1594
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1595
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
1596
return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
1597
}
1598
}
1599
break;
1600
case -3:
1601
if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
1602
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
1603
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1604
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
1605
return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
1606
}
1607
}
1608
break;
1609
case 3:
1610
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
1611
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
1612
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1613
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
1614
return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
1615
}
1616
}
1617
break;
1618
case -4:
1619
if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
1620
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
1621
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1622
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
1623
return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
1624
}
1625
}
1626
break;
1627
case 4:
1628
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
1629
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
1630
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
1631
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
1632
return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
1633
}
1634
}
1635
break;
1636
}
1637
#endif
1638
if (sizeof(int) <= sizeof(long)) {
1639
__PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
1640
#ifdef HAVE_LONG_LONG
1641
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
1642
__PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
1643
#endif
1644
}
1645
}
1646
{
1647
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
1648
PyErr_SetString(PyExc_RuntimeError,
1649
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
1650
#else
1651
int val;
1652
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
1653
#if PY_MAJOR_VERSION < 3
1654
if (likely(v) && !PyLong_Check(v)) {
1655
PyObject *tmp = v;
1656
v = PyNumber_Long(tmp);
1657
Py_DECREF(tmp);
1658
}
1659
#endif
1660
if (likely(v)) {
1661
int one = 1; int is_little = (int)*(unsigned char *)&one;
1662
unsigned char *bytes = (unsigned char *)&val;
1663
int ret = _PyLong_AsByteArray((PyLongObject *)v,
1664
bytes, sizeof(val),
1665
is_little, !is_unsigned);
1666
Py_DECREF(v);
1667
if (likely(!ret))
1668
return val;
1669
}
1670
#endif
1671
return (int) -1;
1672
}
1673
} else {
1674
int val;
1675
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
1676
if (!tmp) return (int) -1;
1677
val = __Pyx_PyInt_As_int(tmp);
1678
Py_DECREF(tmp);
1679
return val;
1680
}
1681
raise_overflow:
1682
PyErr_SetString(PyExc_OverflowError,
1683
"value too large to convert to int");
1684
return (int) -1;
1685
raise_neg_overflow:
1686
PyErr_SetString(PyExc_OverflowError,
1687
"can't convert negative value to int");
1688
return (int) -1;
1689
}
1690
1691
/* CheckBinaryVersion */
1692
static int __Pyx_check_binary_version(void) {
1693
char ctversion[4], rtversion[4];
1694
PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
1695
PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
1696
if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
1697
char message[200];
1698
PyOS_snprintf(message, sizeof(message),
1699
"compiletime version %s of module '%.100s' "
1700
"does not match runtime version %s",
1701
ctversion, __Pyx_MODULE_NAME, rtversion);
1702
return PyErr_WarnEx(NULL, message, 1);
1703
}
1704
return 0;
1705
}
1706
1707
/* InitStrings */
1708
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
1709
while (t->p) {
1710
#if PY_MAJOR_VERSION < 3
1711
if (t->is_unicode) {
1712
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
1713
} else if (t->intern) {
1714
*t->p = PyString_InternFromString(t->s);
1715
} else {
1716
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
1717
}
1718
#else
1719
if (t->is_unicode | t->is_str) {
1720
if (t->intern) {
1721
*t->p = PyUnicode_InternFromString(t->s);
1722
} else if (t->encoding) {
1723
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
1724
} else {
1725
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
1726
}
1727
} else {
1728
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
1729
}
1730
#endif
1731
if (!*t->p)
1732
return -1;
1733
++t;
1734
}
1735
return 0;
1736
}
1737
1738
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
1739
return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
1740
}
1741
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
1742
Py_ssize_t ignore;
1743
return __Pyx_PyObject_AsStringAndSize(o, &ignore);
1744
}
1745
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
1746
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
1747
if (
1748
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
1749
__Pyx_sys_getdefaultencoding_not_ascii &&
1750
#endif
1751
PyUnicode_Check(o)) {
1752
#if PY_VERSION_HEX < 0x03030000
1753
char* defenc_c;
1754
PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
1755
if (!defenc) return NULL;
1756
defenc_c = PyBytes_AS_STRING(defenc);
1757
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
1758
{
1759
char* end = defenc_c + PyBytes_GET_SIZE(defenc);
1760
char* c;
1761
for (c = defenc_c; c < end; c++) {
1762
if ((unsigned char) (*c) >= 128) {
1763
PyUnicode_AsASCIIString(o);
1764
return NULL;
1765
}
1766
}
1767
}
1768
#endif
1769
*length = PyBytes_GET_SIZE(defenc);
1770
return defenc_c;
1771
#else
1772
if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
1773
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
1774
if (PyUnicode_IS_ASCII(o)) {
1775
*length = PyUnicode_GET_LENGTH(o);
1776
return PyUnicode_AsUTF8(o);
1777
} else {
1778
PyUnicode_AsASCIIString(o);
1779
return NULL;
1780
}
1781
#else
1782
return PyUnicode_AsUTF8AndSize(o, length);
1783
#endif
1784
#endif
1785
} else
1786
#endif
1787
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
1788
if (PyByteArray_Check(o)) {
1789
*length = PyByteArray_GET_SIZE(o);
1790
return PyByteArray_AS_STRING(o);
1791
} else
1792
#endif
1793
{
1794
char* result;
1795
int r = PyBytes_AsStringAndSize(o, &result, length);
1796
if (unlikely(r < 0)) {
1797
return NULL;
1798
} else {
1799
return result;
1800
}
1801
}
1802
}
1803
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
1804
int is_true = x == Py_True;
1805
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
1806
else return PyObject_IsTrue(x);
1807
}
1808
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
1809
#if CYTHON_USE_TYPE_SLOTS
1810
PyNumberMethods *m;
1811
#endif
1812
const char *name = NULL;
1813
PyObject *res = NULL;
1814
#if PY_MAJOR_VERSION < 3
1815
if (PyInt_Check(x) || PyLong_Check(x))
1816
#else
1817
if (PyLong_Check(x))
1818
#endif
1819
return __Pyx_NewRef(x);
1820
#if CYTHON_USE_TYPE_SLOTS
1821
m = Py_TYPE(x)->tp_as_number;
1822
#if PY_MAJOR_VERSION < 3
1823
if (m && m->nb_int) {
1824
name = "int";
1825
res = PyNumber_Int(x);
1826
}
1827
else if (m && m->nb_long) {
1828
name = "long";
1829
res = PyNumber_Long(x);
1830
}
1831
#else
1832
if (m && m->nb_int) {
1833
name = "int";
1834
res = PyNumber_Long(x);
1835
}
1836
#endif
1837
#else
1838
res = PyNumber_Int(x);
1839
#endif
1840
if (res) {
1841
#if PY_MAJOR_VERSION < 3
1842
if (!PyInt_Check(res) && !PyLong_Check(res)) {
1843
#else
1844
if (!PyLong_Check(res)) {
1845
#endif
1846
PyErr_Format(PyExc_TypeError,
1847
"__%.4s__ returned non-%.4s (type %.200s)",
1848
name, name, Py_TYPE(res)->tp_name);
1849
Py_DECREF(res);
1850
return NULL;
1851
}
1852
}
1853
else if (!PyErr_Occurred()) {
1854
PyErr_SetString(PyExc_TypeError,
1855
"an integer is required");
1856
}
1857
return res;
1858
}
1859
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
1860
Py_ssize_t ival;
1861
PyObject *x;
1862
#if PY_MAJOR_VERSION < 3
1863
if (likely(PyInt_CheckExact(b))) {
1864
if (sizeof(Py_ssize_t) >= sizeof(long))
1865
return PyInt_AS_LONG(b);
1866
else
1867
return PyInt_AsSsize_t(x);
1868
}
1869
#endif
1870
if (likely(PyLong_CheckExact(b))) {
1871
#if CYTHON_USE_PYLONG_INTERNALS
1872
const digit* digits = ((PyLongObject*)b)->ob_digit;
1873
const Py_ssize_t size = Py_SIZE(b);
1874
if (likely(__Pyx_sst_abs(size) <= 1)) {
1875
ival = likely(size) ? digits[0] : 0;
1876
if (size == -1) ival = -ival;
1877
return ival;
1878
} else {
1879
switch (size) {
1880
case 2:
1881
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
1882
return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
1883
}
1884
break;
1885
case -2:
1886
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
1887
return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
1888
}
1889
break;
1890
case 3:
1891
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
1892
return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
1893
}
1894
break;
1895
case -3:
1896
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
1897
return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
1898
}
1899
break;
1900
case 4:
1901
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
1902
return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
1903
}
1904
break;
1905
case -4:
1906
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
1907
return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
1908
}
1909
break;
1910
}
1911
}
1912
#endif
1913
return PyLong_AsSsize_t(b);
1914
}
1915
x = PyNumber_Index(b);
1916
if (!x) return -1;
1917
ival = PyInt_AsSsize_t(x);
1918
Py_DECREF(x);
1919
return ival;
1920
}
1921
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
1922
return PyInt_FromSize_t(ival);
1923
}
1924
1925
1926
#endif /* Py_PYTHON_H */
1927
1928