Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
241818 views
1
/* Generated by Cython 0.25.2 */
2
3
#define PY_SSIZE_T_CLEAN
4
#include "Python.h"
5
#ifndef Py_PYTHON_H
6
#error Python headers needed to compile C extensions, please install development version of Python.
7
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
8
#error Cython requires Python 2.6+ or Python 3.2+.
9
#else
10
#define CYTHON_ABI "0_25_2"
11
#include <stddef.h>
12
#ifndef offsetof
13
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
14
#endif
15
#if !defined(WIN32) && !defined(MS_WINDOWS)
16
#ifndef __stdcall
17
#define __stdcall
18
#endif
19
#ifndef __cdecl
20
#define __cdecl
21
#endif
22
#ifndef __fastcall
23
#define __fastcall
24
#endif
25
#endif
26
#ifndef DL_IMPORT
27
#define DL_IMPORT(t) t
28
#endif
29
#ifndef DL_EXPORT
30
#define DL_EXPORT(t) t
31
#endif
32
#ifndef HAVE_LONG_LONG
33
#if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000)
34
#define HAVE_LONG_LONG
35
#endif
36
#endif
37
#ifndef PY_LONG_LONG
38
#define PY_LONG_LONG LONG_LONG
39
#endif
40
#ifndef Py_HUGE_VAL
41
#define Py_HUGE_VAL HUGE_VAL
42
#endif
43
#ifdef PYPY_VERSION
44
#define CYTHON_COMPILING_IN_PYPY 1
45
#define CYTHON_COMPILING_IN_PYSTON 0
46
#define CYTHON_COMPILING_IN_CPYTHON 0
47
#undef CYTHON_USE_TYPE_SLOTS
48
#define CYTHON_USE_TYPE_SLOTS 0
49
#undef CYTHON_USE_ASYNC_SLOTS
50
#define CYTHON_USE_ASYNC_SLOTS 0
51
#undef CYTHON_USE_PYLIST_INTERNALS
52
#define CYTHON_USE_PYLIST_INTERNALS 0
53
#undef CYTHON_USE_UNICODE_INTERNALS
54
#define CYTHON_USE_UNICODE_INTERNALS 0
55
#undef CYTHON_USE_UNICODE_WRITER
56
#define CYTHON_USE_UNICODE_WRITER 0
57
#undef CYTHON_USE_PYLONG_INTERNALS
58
#define CYTHON_USE_PYLONG_INTERNALS 0
59
#undef CYTHON_AVOID_BORROWED_REFS
60
#define CYTHON_AVOID_BORROWED_REFS 1
61
#undef CYTHON_ASSUME_SAFE_MACROS
62
#define CYTHON_ASSUME_SAFE_MACROS 0
63
#undef CYTHON_UNPACK_METHODS
64
#define CYTHON_UNPACK_METHODS 0
65
#undef CYTHON_FAST_THREAD_STATE
66
#define CYTHON_FAST_THREAD_STATE 0
67
#undef CYTHON_FAST_PYCALL
68
#define CYTHON_FAST_PYCALL 0
69
#elif defined(PYSTON_VERSION)
70
#define CYTHON_COMPILING_IN_PYPY 0
71
#define CYTHON_COMPILING_IN_PYSTON 1
72
#define CYTHON_COMPILING_IN_CPYTHON 0
73
#ifndef CYTHON_USE_TYPE_SLOTS
74
#define CYTHON_USE_TYPE_SLOTS 1
75
#endif
76
#undef CYTHON_USE_ASYNC_SLOTS
77
#define CYTHON_USE_ASYNC_SLOTS 0
78
#undef CYTHON_USE_PYLIST_INTERNALS
79
#define CYTHON_USE_PYLIST_INTERNALS 0
80
#ifndef CYTHON_USE_UNICODE_INTERNALS
81
#define CYTHON_USE_UNICODE_INTERNALS 1
82
#endif
83
#undef CYTHON_USE_UNICODE_WRITER
84
#define CYTHON_USE_UNICODE_WRITER 0
85
#undef CYTHON_USE_PYLONG_INTERNALS
86
#define CYTHON_USE_PYLONG_INTERNALS 0
87
#ifndef CYTHON_AVOID_BORROWED_REFS
88
#define CYTHON_AVOID_BORROWED_REFS 0
89
#endif
90
#ifndef CYTHON_ASSUME_SAFE_MACROS
91
#define CYTHON_ASSUME_SAFE_MACROS 1
92
#endif
93
#ifndef CYTHON_UNPACK_METHODS
94
#define CYTHON_UNPACK_METHODS 1
95
#endif
96
#undef CYTHON_FAST_THREAD_STATE
97
#define CYTHON_FAST_THREAD_STATE 0
98
#undef CYTHON_FAST_PYCALL
99
#define CYTHON_FAST_PYCALL 0
100
#else
101
#define CYTHON_COMPILING_IN_PYPY 0
102
#define CYTHON_COMPILING_IN_PYSTON 0
103
#define CYTHON_COMPILING_IN_CPYTHON 1
104
#ifndef CYTHON_USE_TYPE_SLOTS
105
#define CYTHON_USE_TYPE_SLOTS 1
106
#endif
107
#if PY_MAJOR_VERSION < 3
108
#undef CYTHON_USE_ASYNC_SLOTS
109
#define CYTHON_USE_ASYNC_SLOTS 0
110
#elif !defined(CYTHON_USE_ASYNC_SLOTS)
111
#define CYTHON_USE_ASYNC_SLOTS 1
112
#endif
113
#if PY_VERSION_HEX < 0x02070000
114
#undef CYTHON_USE_PYLONG_INTERNALS
115
#define CYTHON_USE_PYLONG_INTERNALS 0
116
#elif !defined(CYTHON_USE_PYLONG_INTERNALS)
117
#define CYTHON_USE_PYLONG_INTERNALS 1
118
#endif
119
#ifndef CYTHON_USE_PYLIST_INTERNALS
120
#define CYTHON_USE_PYLIST_INTERNALS 1
121
#endif
122
#ifndef CYTHON_USE_UNICODE_INTERNALS
123
#define CYTHON_USE_UNICODE_INTERNALS 1
124
#endif
125
#if PY_VERSION_HEX < 0x030300F0
126
#undef CYTHON_USE_UNICODE_WRITER
127
#define CYTHON_USE_UNICODE_WRITER 0
128
#elif !defined(CYTHON_USE_UNICODE_WRITER)
129
#define CYTHON_USE_UNICODE_WRITER 1
130
#endif
131
#ifndef CYTHON_AVOID_BORROWED_REFS
132
#define CYTHON_AVOID_BORROWED_REFS 0
133
#endif
134
#ifndef CYTHON_ASSUME_SAFE_MACROS
135
#define CYTHON_ASSUME_SAFE_MACROS 1
136
#endif
137
#ifndef CYTHON_UNPACK_METHODS
138
#define CYTHON_UNPACK_METHODS 1
139
#endif
140
#ifndef CYTHON_FAST_THREAD_STATE
141
#define CYTHON_FAST_THREAD_STATE 1
142
#endif
143
#ifndef CYTHON_FAST_PYCALL
144
#define CYTHON_FAST_PYCALL 1
145
#endif
146
#endif
147
#if !defined(CYTHON_FAST_PYCCALL)
148
#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
149
#endif
150
#if CYTHON_USE_PYLONG_INTERNALS
151
#include "longintrepr.h"
152
#undef SHIFT
153
#undef BASE
154
#undef MASK
155
#endif
156
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
157
#define Py_OptimizeFlag 0
158
#endif
159
#define __PYX_BUILD_PY_SSIZE_T "n"
160
#define CYTHON_FORMAT_SSIZE_T "z"
161
#if PY_MAJOR_VERSION < 3
162
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
163
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
164
PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
165
#define __Pyx_DefaultClassType PyClass_Type
166
#else
167
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
168
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
169
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
170
#define __Pyx_DefaultClassType PyType_Type
171
#endif
172
#ifndef Py_TPFLAGS_CHECKTYPES
173
#define Py_TPFLAGS_CHECKTYPES 0
174
#endif
175
#ifndef Py_TPFLAGS_HAVE_INDEX
176
#define Py_TPFLAGS_HAVE_INDEX 0
177
#endif
178
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
179
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
180
#endif
181
#ifndef Py_TPFLAGS_HAVE_FINALIZE
182
#define Py_TPFLAGS_HAVE_FINALIZE 0
183
#endif
184
#ifndef METH_FASTCALL
185
#define METH_FASTCALL 0x80
186
typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args,
187
Py_ssize_t nargs, PyObject *kwnames);
188
#else
189
#define __Pyx_PyCFunctionFast _PyCFunctionFast
190
#endif
191
#if CYTHON_FAST_PYCCALL
192
#define __Pyx_PyFastCFunction_Check(func)\
193
((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)))))
194
#else
195
#define __Pyx_PyFastCFunction_Check(func) 0
196
#endif
197
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
198
#define CYTHON_PEP393_ENABLED 1
199
#define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
200
0 : _PyUnicode_Ready((PyObject *)(op)))
201
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
202
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
203
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
204
#define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
205
#define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
206
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
207
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
208
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
209
#else
210
#define CYTHON_PEP393_ENABLED 0
211
#define PyUnicode_1BYTE_KIND 1
212
#define PyUnicode_2BYTE_KIND 2
213
#define PyUnicode_4BYTE_KIND 4
214
#define __Pyx_PyUnicode_READY(op) (0)
215
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
216
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
217
#define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
218
#define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
219
#define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
220
#define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
221
#define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
222
#define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
223
#endif
224
#if CYTHON_COMPILING_IN_PYPY
225
#define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
226
#define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
227
#else
228
#define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
229
#define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
230
PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
231
#endif
232
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
233
#define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
234
#endif
235
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
236
#define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
237
#endif
238
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
239
#define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
240
#endif
241
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
242
#define PyObject_Malloc(s) PyMem_Malloc(s)
243
#define PyObject_Free(p) PyMem_Free(p)
244
#define PyObject_Realloc(p) PyMem_Realloc(p)
245
#endif
246
#if CYTHON_COMPILING_IN_PYSTON
247
#define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
248
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
249
#else
250
#define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
251
#define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
252
#endif
253
#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
254
#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
255
#if PY_MAJOR_VERSION >= 3
256
#define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
257
#else
258
#define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
259
#endif
260
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
261
#define PyObject_ASCII(o) PyObject_Repr(o)
262
#endif
263
#if PY_MAJOR_VERSION >= 3
264
#define PyBaseString_Type PyUnicode_Type
265
#define PyStringObject PyUnicodeObject
266
#define PyString_Type PyUnicode_Type
267
#define PyString_Check PyUnicode_Check
268
#define PyString_CheckExact PyUnicode_CheckExact
269
#endif
270
#if PY_MAJOR_VERSION >= 3
271
#define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
272
#define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
273
#else
274
#define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
275
#define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
276
#endif
277
#ifndef PySet_CheckExact
278
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
279
#endif
280
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
281
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
282
#if PY_MAJOR_VERSION >= 3
283
#define PyIntObject PyLongObject
284
#define PyInt_Type PyLong_Type
285
#define PyInt_Check(op) PyLong_Check(op)
286
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
287
#define PyInt_FromString PyLong_FromString
288
#define PyInt_FromUnicode PyLong_FromUnicode
289
#define PyInt_FromLong PyLong_FromLong
290
#define PyInt_FromSize_t PyLong_FromSize_t
291
#define PyInt_FromSsize_t PyLong_FromSsize_t
292
#define PyInt_AsLong PyLong_AsLong
293
#define PyInt_AS_LONG PyLong_AS_LONG
294
#define PyInt_AsSsize_t PyLong_AsSsize_t
295
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
296
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
297
#define PyNumber_Int PyNumber_Long
298
#endif
299
#if PY_MAJOR_VERSION >= 3
300
#define PyBoolObject PyLongObject
301
#endif
302
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
303
#ifndef PyUnicode_InternFromString
304
#define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
305
#endif
306
#endif
307
#if PY_VERSION_HEX < 0x030200A4
308
typedef long Py_hash_t;
309
#define __Pyx_PyInt_FromHash_t PyInt_FromLong
310
#define __Pyx_PyInt_AsHash_t PyInt_AsLong
311
#else
312
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
313
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
314
#endif
315
#if PY_MAJOR_VERSION >= 3
316
#define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
317
#else
318
#define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
319
#endif
320
#if CYTHON_USE_ASYNC_SLOTS
321
#if PY_VERSION_HEX >= 0x030500B1
322
#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
323
#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
324
#else
325
typedef struct {
326
unaryfunc am_await;
327
unaryfunc am_aiter;
328
unaryfunc am_anext;
329
} __Pyx_PyAsyncMethodsStruct;
330
#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
331
#endif
332
#else
333
#define __Pyx_PyType_AsAsync(obj) NULL
334
#endif
335
#ifndef CYTHON_RESTRICT
336
#if defined(__GNUC__)
337
#define CYTHON_RESTRICT __restrict__
338
#elif defined(_MSC_VER) && _MSC_VER >= 1400
339
#define CYTHON_RESTRICT __restrict
340
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
341
#define CYTHON_RESTRICT restrict
342
#else
343
#define CYTHON_RESTRICT
344
#endif
345
#endif
346
#ifndef CYTHON_UNUSED
347
# if defined(__GNUC__)
348
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
349
# define CYTHON_UNUSED __attribute__ ((__unused__))
350
# else
351
# define CYTHON_UNUSED
352
# endif
353
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
354
# define CYTHON_UNUSED __attribute__ ((__unused__))
355
# else
356
# define CYTHON_UNUSED
357
# endif
358
#endif
359
#ifndef CYTHON_MAYBE_UNUSED_VAR
360
# if defined(__cplusplus)
361
template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
362
# else
363
# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
364
# endif
365
#endif
366
#ifndef CYTHON_NCP_UNUSED
367
# if CYTHON_COMPILING_IN_CPYTHON
368
# define CYTHON_NCP_UNUSED
369
# else
370
# define CYTHON_NCP_UNUSED CYTHON_UNUSED
371
# endif
372
#endif
373
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
374
375
#ifndef CYTHON_INLINE
376
#if defined(__clang__)
377
#define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
378
#elif defined(__GNUC__)
379
#define CYTHON_INLINE __inline__
380
#elif defined(_MSC_VER)
381
#define CYTHON_INLINE __inline
382
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
383
#define CYTHON_INLINE inline
384
#else
385
#define CYTHON_INLINE
386
#endif
387
#endif
388
389
#if defined(WIN32) || defined(MS_WINDOWS)
390
#define _USE_MATH_DEFINES
391
#endif
392
#include <math.h>
393
#ifdef NAN
394
#define __PYX_NAN() ((float) NAN)
395
#else
396
static CYTHON_INLINE float __PYX_NAN() {
397
float value;
398
memset(&value, 0xFF, sizeof(value));
399
return value;
400
}
401
#endif
402
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
403
#define __Pyx_truncl trunc
404
#else
405
#define __Pyx_truncl truncl
406
#endif
407
408
409
#define __PYX_ERR(f_index, lineno, Ln_error) \
410
{ \
411
__pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
412
}
413
414
#if PY_MAJOR_VERSION >= 3
415
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
416
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
417
#else
418
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
419
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
420
#endif
421
422
#ifndef __PYX_EXTERN_C
423
#ifdef __cplusplus
424
#define __PYX_EXTERN_C extern "C"
425
#else
426
#define __PYX_EXTERN_C extern
427
#endif
428
#endif
429
430
#define __PYX_HAVE__code__alex__psage__psage__libs__smalljac__wrapper2
431
#define __PYX_HAVE_API__code__alex__psage__psage__libs__smalljac__wrapper2
432
#include "smalljac.h"
433
#include "struct_signals.h"
434
#include "pxi.h"
435
#include <string.h>
436
#include <stdlib.h>
437
#include <stdio.h>
438
#ifdef _OPENMP
439
#include <omp.h>
440
#endif /* _OPENMP */
441
442
#ifdef PYREX_WITHOUT_ASSERTIONS
443
#define CYTHON_WITHOUT_ASSERTIONS
444
#endif
445
446
typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
447
const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
448
449
#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
450
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
451
#define __PYX_DEFAULT_STRING_ENCODING ""
452
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
453
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
454
#define __Pyx_uchar_cast(c) ((unsigned char)c)
455
#define __Pyx_long_cast(x) ((long)x)
456
#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
457
(sizeof(type) < sizeof(Py_ssize_t)) ||\
458
(sizeof(type) > sizeof(Py_ssize_t) &&\
459
likely(v < (type)PY_SSIZE_T_MAX ||\
460
v == (type)PY_SSIZE_T_MAX) &&\
461
(!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
462
v == (type)PY_SSIZE_T_MIN))) ||\
463
(sizeof(type) == sizeof(Py_ssize_t) &&\
464
(is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
465
v == (type)PY_SSIZE_T_MAX))) )
466
#if defined (__cplusplus) && __cplusplus >= 201103L
467
#include <cstdlib>
468
#define __Pyx_sst_abs(value) std::abs(value)
469
#elif SIZEOF_INT >= SIZEOF_SIZE_T
470
#define __Pyx_sst_abs(value) abs(value)
471
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
472
#define __Pyx_sst_abs(value) labs(value)
473
#elif defined (_MSC_VER) && defined (_M_X64)
474
#define __Pyx_sst_abs(value) _abs64(value)
475
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
476
#define __Pyx_sst_abs(value) llabs(value)
477
#elif defined (__GNUC__)
478
#define __Pyx_sst_abs(value) __builtin_llabs(value)
479
#else
480
#define __Pyx_sst_abs(value) ((value<0) ? -value : value)
481
#endif
482
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
483
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
484
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
485
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
486
#define __Pyx_PyBytes_FromString PyBytes_FromString
487
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
488
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
489
#if PY_MAJOR_VERSION < 3
490
#define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
491
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
492
#else
493
#define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
494
#define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
495
#endif
496
#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
497
#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
498
#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
499
#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
500
#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
501
#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
502
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
503
#if PY_MAJOR_VERSION < 3
504
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
505
{
506
const Py_UNICODE *u_end = u;
507
while (*u_end++) ;
508
return (size_t)(u_end - u - 1);
509
}
510
#else
511
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
512
#endif
513
#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
514
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
515
#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
516
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
517
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
518
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
519
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
520
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
521
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
522
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
523
#if CYTHON_ASSUME_SAFE_MACROS
524
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
525
#else
526
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
527
#endif
528
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
529
#if PY_MAJOR_VERSION >= 3
530
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
531
#else
532
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
533
#endif
534
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
535
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
536
static int __Pyx_sys_getdefaultencoding_not_ascii;
537
static int __Pyx_init_sys_getdefaultencoding_params(void) {
538
PyObject* sys;
539
PyObject* default_encoding = NULL;
540
PyObject* ascii_chars_u = NULL;
541
PyObject* ascii_chars_b = NULL;
542
const char* default_encoding_c;
543
sys = PyImport_ImportModule("sys");
544
if (!sys) goto bad;
545
default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
546
Py_DECREF(sys);
547
if (!default_encoding) goto bad;
548
default_encoding_c = PyBytes_AsString(default_encoding);
549
if (!default_encoding_c) goto bad;
550
if (strcmp(default_encoding_c, "ascii") == 0) {
551
__Pyx_sys_getdefaultencoding_not_ascii = 0;
552
} else {
553
char ascii_chars[128];
554
int c;
555
for (c = 0; c < 128; c++) {
556
ascii_chars[c] = c;
557
}
558
__Pyx_sys_getdefaultencoding_not_ascii = 1;
559
ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
560
if (!ascii_chars_u) goto bad;
561
ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
562
if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
563
PyErr_Format(
564
PyExc_ValueError,
565
"This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
566
default_encoding_c);
567
goto bad;
568
}
569
Py_DECREF(ascii_chars_u);
570
Py_DECREF(ascii_chars_b);
571
}
572
Py_DECREF(default_encoding);
573
return 0;
574
bad:
575
Py_XDECREF(default_encoding);
576
Py_XDECREF(ascii_chars_u);
577
Py_XDECREF(ascii_chars_b);
578
return -1;
579
}
580
#endif
581
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
582
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
583
#else
584
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
585
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
586
static char* __PYX_DEFAULT_STRING_ENCODING;
587
static int __Pyx_init_sys_getdefaultencoding_params(void) {
588
PyObject* sys;
589
PyObject* default_encoding = NULL;
590
char* default_encoding_c;
591
sys = PyImport_ImportModule("sys");
592
if (!sys) goto bad;
593
default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
594
Py_DECREF(sys);
595
if (!default_encoding) goto bad;
596
default_encoding_c = PyBytes_AsString(default_encoding);
597
if (!default_encoding_c) goto bad;
598
__PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
599
if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
600
strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
601
Py_DECREF(default_encoding);
602
return 0;
603
bad:
604
Py_XDECREF(default_encoding);
605
return -1;
606
}
607
#endif
608
#endif
609
610
611
/* Test for GCC > 2.95 */
612
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
613
#define likely(x) __builtin_expect(!!(x), 1)
614
#define unlikely(x) __builtin_expect(!!(x), 0)
615
#else /* !__GNUC__ or GCC < 2.95 */
616
#define likely(x) (x)
617
#define unlikely(x) (x)
618
#endif /* __GNUC__ */
619
620
static PyObject *__pyx_m;
621
static PyObject *__pyx_d;
622
static PyObject *__pyx_b;
623
static PyObject *__pyx_empty_tuple;
624
static PyObject *__pyx_empty_bytes;
625
static PyObject *__pyx_empty_unicode;
626
static int __pyx_lineno;
627
static int __pyx_clineno = 0;
628
static const char * __pyx_cfilenm= __FILE__;
629
static const char *__pyx_filename;
630
631
632
static const char *__pyx_f[] = {
633
"code/alex/psage/psage/libs/smalljac/wrapper0.pyx",
634
"code/alex/psage/psage/libs/smalljac/wrapper2.pyx",
635
"memory.pxd",
636
"stdsage.pxd",
637
"type.pxd",
638
"signals.pxi",
639
"stdsage.pxi",
640
};
641
642
/*--- Type declarations ---*/
643
struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac;
644
struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_GroupModp;
645
struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly;
646
647
/* "wrapper0.pyx":3
648
* from defs cimport *
649
*
650
* cdef class SmallJac: # <<<<<<<<<<<<<<
651
* cdef smalljac_Qcurve_t c
652
* cdef object tmp
653
*/
654
struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac {
655
PyObject_HEAD
656
struct __pyx_vtabstruct_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_vtab;
657
smalljac_Qcurve_t c;
658
PyObject *tmp;
659
};
660
661
662
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":5
663
*
664
*
665
* cdef class GroupModp: # <<<<<<<<<<<<<<
666
* pass
667
*
668
*/
669
struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_GroupModp {
670
PyObject_HEAD
671
};
672
673
674
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":8
675
* pass
676
*
677
* cdef class FrobPoly: # <<<<<<<<<<<<<<
678
* cdef long a0, a1
679
* cdef unsigned long p
680
*/
681
struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly {
682
PyObject_HEAD
683
long a0;
684
long a1;
685
unsigned long p;
686
};
687
688
689
690
/* "wrapper0.pyx":3
691
* from defs cimport *
692
*
693
* cdef class SmallJac: # <<<<<<<<<<<<<<
694
* cdef smalljac_Qcurve_t c
695
* cdef object tmp
696
*/
697
698
struct __pyx_vtabstruct_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac {
699
int (*genus)(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *, int __pyx_skip_dispatch);
700
};
701
static struct __pyx_vtabstruct_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_vtabptr_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac;
702
703
/* --- Runtime support code (head) --- */
704
/* Refnanny.proto */
705
#ifndef CYTHON_REFNANNY
706
#define CYTHON_REFNANNY 0
707
#endif
708
#if CYTHON_REFNANNY
709
typedef struct {
710
void (*INCREF)(void*, PyObject*, int);
711
void (*DECREF)(void*, PyObject*, int);
712
void (*GOTREF)(void*, PyObject*, int);
713
void (*GIVEREF)(void*, PyObject*, int);
714
void* (*SetupContext)(const char*, int, const char*);
715
void (*FinishContext)(void**);
716
} __Pyx_RefNannyAPIStruct;
717
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
718
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
719
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
720
#ifdef WITH_THREAD
721
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
722
if (acquire_gil) {\
723
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
724
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
725
PyGILState_Release(__pyx_gilstate_save);\
726
} else {\
727
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
728
}
729
#else
730
#define __Pyx_RefNannySetupContext(name, acquire_gil)\
731
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
732
#endif
733
#define __Pyx_RefNannyFinishContext()\
734
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
735
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
736
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
737
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
738
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
739
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
740
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
741
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
742
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
743
#else
744
#define __Pyx_RefNannyDeclarations
745
#define __Pyx_RefNannySetupContext(name, acquire_gil)
746
#define __Pyx_RefNannyFinishContext()
747
#define __Pyx_INCREF(r) Py_INCREF(r)
748
#define __Pyx_DECREF(r) Py_DECREF(r)
749
#define __Pyx_GOTREF(r)
750
#define __Pyx_GIVEREF(r)
751
#define __Pyx_XINCREF(r) Py_XINCREF(r)
752
#define __Pyx_XDECREF(r) Py_XDECREF(r)
753
#define __Pyx_XGOTREF(r)
754
#define __Pyx_XGIVEREF(r)
755
#endif
756
#define __Pyx_XDECREF_SET(r, v) do {\
757
PyObject *tmp = (PyObject *) r;\
758
r = v; __Pyx_XDECREF(tmp);\
759
} while (0)
760
#define __Pyx_DECREF_SET(r, v) do {\
761
PyObject *tmp = (PyObject *) r;\
762
r = v; __Pyx_DECREF(tmp);\
763
} while (0)
764
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
765
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
766
767
/* PyObjectGetAttrStr.proto */
768
#if CYTHON_USE_TYPE_SLOTS
769
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
770
PyTypeObject* tp = Py_TYPE(obj);
771
if (likely(tp->tp_getattro))
772
return tp->tp_getattro(obj, attr_name);
773
#if PY_MAJOR_VERSION < 3
774
if (likely(tp->tp_getattr))
775
return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
776
#endif
777
return PyObject_GetAttr(obj, attr_name);
778
}
779
#else
780
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
781
#endif
782
783
/* GetBuiltinName.proto */
784
static PyObject *__Pyx_GetBuiltinName(PyObject *name);
785
786
/* RaiseArgTupleInvalid.proto */
787
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
788
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
789
790
/* KeywordStringCheck.proto */
791
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);
792
793
/* RaiseDoubleKeywords.proto */
794
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
795
796
/* ParseKeywords.proto */
797
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
798
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
799
const char* function_name);
800
801
/* PyObjectCall.proto */
802
#if CYTHON_COMPILING_IN_CPYTHON
803
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
804
#else
805
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
806
#endif
807
808
/* PyThreadStateGet.proto */
809
#if CYTHON_FAST_THREAD_STATE
810
#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
811
#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET();
812
#else
813
#define __Pyx_PyThreadState_declare
814
#define __Pyx_PyThreadState_assign
815
#endif
816
817
/* PyErrFetchRestore.proto */
818
#if CYTHON_FAST_THREAD_STATE
819
#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
820
#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
821
#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
822
#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
823
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
824
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
825
#else
826
#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
827
#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
828
#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
829
#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
830
#endif
831
832
/* RaiseException.proto */
833
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
834
835
/* PyCFunctionFastCall.proto */
836
#if CYTHON_FAST_PYCCALL
837
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
838
#else
839
#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
840
#endif
841
842
/* PyFunctionFastCall.proto */
843
#if CYTHON_FAST_PYCALL
844
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
845
__Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
846
#if 1 || PY_VERSION_HEX < 0x030600B1
847
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
848
#else
849
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
850
#endif
851
#endif
852
853
/* PyObjectCallMethO.proto */
854
#if CYTHON_COMPILING_IN_CPYTHON
855
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
856
#endif
857
858
/* PyObjectCallOneArg.proto */
859
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
860
861
/* PyObjectCallNoArg.proto */
862
#if CYTHON_COMPILING_IN_CPYTHON
863
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
864
#else
865
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
866
#endif
867
868
/* WriteUnraisableException.proto */
869
static void __Pyx_WriteUnraisable(const char *name, int clineno,
870
int lineno, const char *filename,
871
int full_traceback, int nogil);
872
873
/* GetModuleGlobalName.proto */
874
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
875
876
/* Import.proto */
877
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
878
879
/* ImportFrom.proto */
880
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
881
882
/* ExtTypeTest.proto */
883
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
884
885
/* SetVTable.proto */
886
static int __Pyx_SetVtable(PyObject *dict, void *vtable);
887
888
/* GetNameInClass.proto */
889
static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name);
890
891
/* CodeObjectCache.proto */
892
typedef struct {
893
PyCodeObject* code_object;
894
int code_line;
895
} __Pyx_CodeObjectCacheEntry;
896
struct __Pyx_CodeObjectCache {
897
int count;
898
int max_count;
899
__Pyx_CodeObjectCacheEntry* entries;
900
};
901
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
902
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
903
static PyCodeObject *__pyx_find_code_object(int code_line);
904
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
905
906
/* AddTraceback.proto */
907
static void __Pyx_AddTraceback(const char *funcname, int c_line,
908
int py_line, const char *filename);
909
910
/* CIntToPy.proto */
911
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
912
913
/* CIntToPy.proto */
914
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
915
916
/* CIntToPy.proto */
917
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value);
918
919
/* CIntFromPy.proto */
920
static CYTHON_INLINE unsigned long __Pyx_PyInt_As_unsigned_long(PyObject *);
921
922
/* CIntFromPy.proto */
923
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
924
925
/* CIntFromPy.proto */
926
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
927
928
/* CheckBinaryVersion.proto */
929
static int __Pyx_check_binary_version(void);
930
931
/* PyIdentifierFromString.proto */
932
#if !defined(__Pyx_PyIdentifier_FromString)
933
#if PY_MAJOR_VERSION < 3
934
#define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
935
#else
936
#define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
937
#endif
938
#endif
939
940
/* ModuleImport.proto */
941
static PyObject *__Pyx_ImportModule(const char *name);
942
943
/* TypeImport.proto */
944
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
945
946
/* VoidPtrImport.proto */
947
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig);
948
949
/* InitStrings.proto */
950
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
951
952
static int __pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_genus(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
953
954
/* Module declarations from 'code.alex.psage.psage.libs.smalljac.defs' */
955
956
/* Module declarations from 'cysignals.__init__' */
957
958
/* Module declarations from 'cysignals' */
959
960
/* Module declarations from 'cysignals.signals' */
961
static cysigs_t *__pyx_vp_9cysignals_7signals_cysigs = 0;
962
#define cysigs (*__pyx_vp_9cysignals_7signals_cysigs)
963
static void (*__pyx_f_9cysignals_7signals_print_backtrace)(void); /*proto*/
964
static void (*__pyx_f_9cysignals_7signals__sig_on_interrupt_received)(void); /*proto*/
965
static void (*__pyx_f_9cysignals_7signals__sig_on_recover)(void); /*proto*/
966
static void (*__pyx_f_9cysignals_7signals__sig_off_warning)(char const *, int); /*proto*/
967
968
/* Module declarations from 'cython' */
969
970
/* Module declarations from 'libc.string' */
971
972
/* Module declarations from 'libc.stdlib' */
973
974
/* Module declarations from 'cysignals.memory' */
975
static CYTHON_INLINE void *sig_malloc(size_t); /*proto*/
976
static CYTHON_INLINE void *sig_realloc(void *, size_t); /*proto*/
977
static CYTHON_INLINE void *sig_calloc(size_t, size_t); /*proto*/
978
static CYTHON_INLINE void sig_free(void *); /*proto*/
979
static CYTHON_INLINE size_t __pyx_f_9cysignals_6memory_mul_overflowcheck(size_t, size_t); /*proto*/
980
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_allocarray(size_t, size_t); /*proto*/
981
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_reallocarray(void *, size_t, size_t); /*proto*/
982
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_malloc(size_t); /*proto*/
983
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_realloc(void *, size_t); /*proto*/
984
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_calloc(size_t, size_t); /*proto*/
985
986
/* Module declarations from 'libc.stdio' */
987
988
/* Module declarations from '__builtin__' */
989
990
/* Module declarations from 'cpython.type' */
991
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
992
993
/* Module declarations from 'cpython' */
994
995
/* Module declarations from 'cpython.object' */
996
997
/* Module declarations from 'sage.ext.stdsage' */
998
static CYTHON_INLINE PyObject *__pyx_f_4sage_3ext_7stdsage_PY_NEW(PyTypeObject *); /*proto*/
999
static CYTHON_INLINE int __pyx_f_4sage_3ext_7stdsage_HAS_DICTIONARY(PyObject *); /*proto*/
1000
1001
/* Module declarations from 'code.alex.psage.psage.libs.smalljac.wrapper2' */
1002
static PyTypeObject *__pyx_ptype_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac = 0;
1003
static PyTypeObject *__pyx_ptype_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_GroupModp = 0;
1004
static PyTypeObject *__pyx_ptype_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly = 0;
1005
static PyObject *__pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly_new(long, long, unsigned long, int __pyx_skip_dispatch); /*proto*/
1006
static int __pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_callback_Lpolys(smalljac_Qcurve_t, unsigned long, int, long *, int, void *); /*proto*/
1007
static int __pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_callback_Lpolys_single(smalljac_Qcurve_t, unsigned long, int, long *, int, void *); /*proto*/
1008
static int __pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_callback_ap_dict(smalljac_Qcurve_t, unsigned long, int, long *, int, void *); /*proto*/
1009
static int __pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_callback_ap_single(smalljac_Qcurve_t, unsigned long, int, long *, int, void *); /*proto*/
1010
#define __Pyx_MODULE_NAME "code.alex.psage.psage.libs.smalljac.wrapper2"
1011
int __pyx_module_is_main_code__alex__psage__psage__libs__smalljac__wrapper2 = 0;
1012
1013
/* Implementation of 'code.alex.psage.psage.libs.smalljac.wrapper2' */
1014
static PyObject *__pyx_builtin_RuntimeError;
1015
static PyObject *__pyx_builtin_NotImplementedError;
1016
static PyObject *__pyx_builtin_MemoryError;
1017
static const char __pyx_k_b[] = "b";
1018
static const char __pyx_k_p[] = "p";
1019
static const char __pyx_k_v[] = "v";
1020
static const char __pyx_k_x[] = "x";
1021
static const char __pyx_k_ZZ[] = "ZZ";
1022
static const char __pyx_k_a0[] = "a0";
1023
static const char __pyx_k_a1[] = "a1";
1024
static const char __pyx_k_var[] = "var";
1025
static const char __pyx_k_main[] = "__main__";
1026
static const char __pyx_k_test[] = "__test__";
1027
static const char __pyx_k_genus[] = "genus";
1028
static const char __pyx_k_import[] = "__import__";
1029
static const char __pyx_k_charpoly[] = "charpoly";
1030
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
1031
static const char __pyx_k_MemoryError[] = "MemoryError";
1032
static const char __pyx_k_Error_code_s[] = "Error code %s";
1033
static const char __pyx_k_FrobPoly_new[] = "FrobPoly_new";
1034
static const char __pyx_k_RuntimeError[] = "RuntimeError";
1035
static const char __pyx_k_sage_rings_all[] = "sage.rings.all";
1036
static const char __pyx_k_sage_ext_memory[] = "sage.ext.memory";
1037
static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
1038
static const char __pyx_k_init_memory_functions[] = "init_memory_functions";
1039
static const char __pyx_k_characteristic_polynomial[] = "characteristic_polynomial";
1040
static const char __pyx_k_failed_to_allocate_s_bytes[] = "failed to allocate %s bytes";
1041
static const char __pyx_k_Smalljac_curve_defined_by_s[] = "Smalljac curve defined by %s";
1042
static const char __pyx_k_failed_to_allocate_s_s_bytes[] = "failed to allocate %s * %s bytes";
1043
static const char __pyx_k_File_wrapper2_pyx_starting_at_li[] = "File: wrapper2.pyx (starting at line 1)";
1044
static const char __pyx_k_Frobenius_in_characteristic_s_wi[] = "Frobenius in characteristic %s with charpoly %s";
1045
static PyObject *__pyx_kp_s_Error_code_s;
1046
static PyObject *__pyx_n_s_FrobPoly_new;
1047
static PyObject *__pyx_kp_s_Frobenius_in_characteristic_s_wi;
1048
static PyObject *__pyx_n_s_MemoryError;
1049
static PyObject *__pyx_n_s_NotImplementedError;
1050
static PyObject *__pyx_n_s_RuntimeError;
1051
static PyObject *__pyx_kp_s_Smalljac_curve_defined_by_s;
1052
static PyObject *__pyx_n_s_ZZ;
1053
static PyObject *__pyx_n_s_a0;
1054
static PyObject *__pyx_n_s_a1;
1055
static PyObject *__pyx_n_s_b;
1056
static PyObject *__pyx_n_s_characteristic_polynomial;
1057
static PyObject *__pyx_n_s_charpoly;
1058
static PyObject *__pyx_kp_s_failed_to_allocate_s_bytes;
1059
static PyObject *__pyx_kp_s_failed_to_allocate_s_s_bytes;
1060
static PyObject *__pyx_n_s_genus;
1061
static PyObject *__pyx_n_s_import;
1062
static PyObject *__pyx_n_s_init_memory_functions;
1063
static PyObject *__pyx_n_s_main;
1064
static PyObject *__pyx_n_s_p;
1065
static PyObject *__pyx_n_s_pyx_vtable;
1066
static PyObject *__pyx_n_s_sage_ext_memory;
1067
static PyObject *__pyx_n_s_sage_rings_all;
1068
static PyObject *__pyx_n_s_test;
1069
static PyObject *__pyx_n_s_v;
1070
static PyObject *__pyx_n_s_var;
1071
static PyObject *__pyx_n_s_x;
1072
static int __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac___cinit__(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self); /* proto */
1073
static int __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_2__init__(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self, PyObject *__pyx_v_v); /* proto */
1074
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_4__repr__(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self); /* proto */
1075
static void __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_6__dealloc__(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self); /* proto */
1076
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_8genus(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self); /* proto */
1077
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_10ap(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self, unsigned long __pyx_v_p, unsigned long __pyx_v_b); /* proto */
1078
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_12frob(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self, unsigned long __pyx_v_p, unsigned long __pyx_v_b); /* proto */
1079
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_14group(CYTHON_UNUSED struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self, CYTHON_UNUSED unsigned long __pyx_v_p, CYTHON_UNUSED unsigned long __pyx_v_b); /* proto */
1080
static int __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly___init__(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *__pyx_v_self, PyObject *__pyx_v_a0, PyObject *__pyx_v_a1, PyObject *__pyx_v_p); /* proto */
1081
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_2__reduce__(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *__pyx_v_self); /* proto */
1082
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_4__repr__(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *__pyx_v_self); /* proto */
1083
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_6prime(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *__pyx_v_self); /* proto */
1084
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_8trace(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *__pyx_v_self); /* proto */
1085
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_10characteristic_polynomial(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *__pyx_v_self, PyObject *__pyx_v_var); /* proto */
1086
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly_new(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_a0, long __pyx_v_a1, unsigned long __pyx_v_p); /* proto */
1087
static PyObject *__pyx_tp_new_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1088
static PyObject *__pyx_tp_new_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_GroupModp(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1089
static PyObject *__pyx_tp_new_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1090
static PyObject *__pyx_int_1;
1091
1092
/* "wrapper0.pyx":7
1093
* cdef object tmp
1094
*
1095
* def __cinit__(self): # <<<<<<<<<<<<<<
1096
* self.c = <smalljac_Qcurve_t>0
1097
*
1098
*/
1099
1100
/* Python wrapper */
1101
static int __pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1102
static int __pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1103
int __pyx_r;
1104
__Pyx_RefNannyDeclarations
1105
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
1106
if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
1107
__Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
1108
if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
1109
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac___cinit__(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_self));
1110
1111
/* function exit code */
1112
__Pyx_RefNannyFinishContext();
1113
return __pyx_r;
1114
}
1115
1116
static int __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac___cinit__(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self) {
1117
int __pyx_r;
1118
__Pyx_RefNannyDeclarations
1119
__Pyx_RefNannySetupContext("__cinit__", 0);
1120
1121
/* "wrapper0.pyx":8
1122
*
1123
* def __cinit__(self):
1124
* self.c = <smalljac_Qcurve_t>0 # <<<<<<<<<<<<<<
1125
*
1126
* def __init__(self, v):
1127
*/
1128
__pyx_v_self->c = ((smalljac_Qcurve_t)0);
1129
1130
/* "wrapper0.pyx":7
1131
* cdef object tmp
1132
*
1133
* def __cinit__(self): # <<<<<<<<<<<<<<
1134
* self.c = <smalljac_Qcurve_t>0
1135
*
1136
*/
1137
1138
/* function exit code */
1139
__pyx_r = 0;
1140
__Pyx_RefNannyFinishContext();
1141
return __pyx_r;
1142
}
1143
1144
/* "wrapper0.pyx":10
1145
* self.c = <smalljac_Qcurve_t>0
1146
*
1147
* def __init__(self, v): # <<<<<<<<<<<<<<
1148
* curve = str(v)
1149
* cdef int err
1150
*/
1151
1152
/* Python wrapper */
1153
static int __pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1154
static char __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_2__init__[] = "File: wrapper0.pyx (starting at line 10)";
1155
#if CYTHON_COMPILING_IN_CPYTHON
1156
struct wrapperbase __pyx_wrapperbase_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_2__init__;
1157
#endif
1158
static int __pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1159
PyObject *__pyx_v_v = 0;
1160
int __pyx_r;
1161
__Pyx_RefNannyDeclarations
1162
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
1163
{
1164
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_v,0};
1165
PyObject* values[1] = {0};
1166
if (unlikely(__pyx_kwds)) {
1167
Py_ssize_t kw_args;
1168
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1169
switch (pos_args) {
1170
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1171
case 0: break;
1172
default: goto __pyx_L5_argtuple_error;
1173
}
1174
kw_args = PyDict_Size(__pyx_kwds);
1175
switch (pos_args) {
1176
case 0:
1177
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_v)) != 0)) kw_args--;
1178
else goto __pyx_L5_argtuple_error;
1179
}
1180
if (unlikely(kw_args > 0)) {
1181
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 10, __pyx_L3_error)
1182
}
1183
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
1184
goto __pyx_L5_argtuple_error;
1185
} else {
1186
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1187
}
1188
__pyx_v_v = values[0];
1189
}
1190
goto __pyx_L4_argument_unpacking_done;
1191
__pyx_L5_argtuple_error:;
1192
__Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 10, __pyx_L3_error)
1193
__pyx_L3_error:;
1194
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.SmallJac.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1195
__Pyx_RefNannyFinishContext();
1196
return -1;
1197
__pyx_L4_argument_unpacking_done:;
1198
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_2__init__(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_self), __pyx_v_v);
1199
1200
/* function exit code */
1201
__Pyx_RefNannyFinishContext();
1202
return __pyx_r;
1203
}
1204
1205
static int __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_2__init__(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self, PyObject *__pyx_v_v) {
1206
PyObject *__pyx_v_curve = NULL;
1207
int __pyx_v_err;
1208
int __pyx_r;
1209
__Pyx_RefNannyDeclarations
1210
PyObject *__pyx_t_1 = NULL;
1211
PyObject *__pyx_t_2 = NULL;
1212
char *__pyx_t_3;
1213
int __pyx_t_4;
1214
__Pyx_RefNannySetupContext("__init__", 0);
1215
1216
/* "wrapper0.pyx":11
1217
*
1218
* def __init__(self, v):
1219
* curve = str(v) # <<<<<<<<<<<<<<
1220
* cdef int err
1221
* self.c = smalljac_Qcurve_init(curve, &err)
1222
*/
1223
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
1224
__Pyx_GOTREF(__pyx_t_1);
1225
__Pyx_INCREF(__pyx_v_v);
1226
__Pyx_GIVEREF(__pyx_v_v);
1227
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_v);
1228
__pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
1229
__Pyx_GOTREF(__pyx_t_2);
1230
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1231
__pyx_v_curve = __pyx_t_2;
1232
__pyx_t_2 = 0;
1233
1234
/* "wrapper0.pyx":13
1235
* curve = str(v)
1236
* cdef int err
1237
* self.c = smalljac_Qcurve_init(curve, &err) # <<<<<<<<<<<<<<
1238
* if err:
1239
* # todo -- see smalljac.h for how to parse this
1240
*/
1241
__pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_curve); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 13, __pyx_L1_error)
1242
__pyx_v_self->c = smalljac_Qcurve_init(__pyx_t_3, (&__pyx_v_err));
1243
1244
/* "wrapper0.pyx":14
1245
* cdef int err
1246
* self.c = smalljac_Qcurve_init(curve, &err)
1247
* if err: # <<<<<<<<<<<<<<
1248
* # todo -- see smalljac.h for how to parse this
1249
* raise RuntimeError, "Error code %s"%err
1250
*/
1251
__pyx_t_4 = (__pyx_v_err != 0);
1252
if (__pyx_t_4) {
1253
1254
/* "wrapper0.pyx":16
1255
* if err:
1256
* # todo -- see smalljac.h for how to parse this
1257
* raise RuntimeError, "Error code %s"%err # <<<<<<<<<<<<<<
1258
*
1259
* def __repr__(self):
1260
*/
1261
__pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_err); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
1262
__Pyx_GOTREF(__pyx_t_2);
1263
__pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Error_code_s, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
1264
__Pyx_GOTREF(__pyx_t_1);
1265
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1266
__Pyx_Raise(__pyx_builtin_RuntimeError, __pyx_t_1, 0, 0);
1267
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1268
__PYX_ERR(0, 16, __pyx_L1_error)
1269
1270
/* "wrapper0.pyx":14
1271
* cdef int err
1272
* self.c = smalljac_Qcurve_init(curve, &err)
1273
* if err: # <<<<<<<<<<<<<<
1274
* # todo -- see smalljac.h for how to parse this
1275
* raise RuntimeError, "Error code %s"%err
1276
*/
1277
}
1278
1279
/* "wrapper0.pyx":10
1280
* self.c = <smalljac_Qcurve_t>0
1281
*
1282
* def __init__(self, v): # <<<<<<<<<<<<<<
1283
* curve = str(v)
1284
* cdef int err
1285
*/
1286
1287
/* function exit code */
1288
__pyx_r = 0;
1289
goto __pyx_L0;
1290
__pyx_L1_error:;
1291
__Pyx_XDECREF(__pyx_t_1);
1292
__Pyx_XDECREF(__pyx_t_2);
1293
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.SmallJac.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1294
__pyx_r = -1;
1295
__pyx_L0:;
1296
__Pyx_XDECREF(__pyx_v_curve);
1297
__Pyx_RefNannyFinishContext();
1298
return __pyx_r;
1299
}
1300
1301
/* "wrapper0.pyx":18
1302
* raise RuntimeError, "Error code %s"%err
1303
*
1304
* def __repr__(self): # <<<<<<<<<<<<<<
1305
* return "Smalljac curve defined by %s"%smalljac_Qcurve_str(self.c)
1306
*
1307
*/
1308
1309
/* Python wrapper */
1310
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_5__repr__(PyObject *__pyx_v_self); /*proto*/
1311
static char __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_4__repr__[] = "File: wrapper0.pyx (starting at line 18)";
1312
#if CYTHON_COMPILING_IN_CPYTHON
1313
struct wrapperbase __pyx_wrapperbase_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_4__repr__;
1314
#endif
1315
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_5__repr__(PyObject *__pyx_v_self) {
1316
PyObject *__pyx_r = 0;
1317
__Pyx_RefNannyDeclarations
1318
__Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
1319
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_4__repr__(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_self));
1320
1321
/* function exit code */
1322
__Pyx_RefNannyFinishContext();
1323
return __pyx_r;
1324
}
1325
1326
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_4__repr__(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self) {
1327
PyObject *__pyx_r = NULL;
1328
__Pyx_RefNannyDeclarations
1329
PyObject *__pyx_t_1 = NULL;
1330
PyObject *__pyx_t_2 = NULL;
1331
__Pyx_RefNannySetupContext("__repr__", 0);
1332
1333
/* "wrapper0.pyx":19
1334
*
1335
* def __repr__(self):
1336
* return "Smalljac curve defined by %s"%smalljac_Qcurve_str(self.c) # <<<<<<<<<<<<<<
1337
*
1338
* def __dealloc__(self):
1339
*/
1340
__Pyx_XDECREF(__pyx_r);
1341
__pyx_t_1 = __Pyx_PyBytes_FromString(smalljac_Qcurve_str(__pyx_v_self->c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
1342
__Pyx_GOTREF(__pyx_t_1);
1343
__pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Smalljac_curve_defined_by_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
1344
__Pyx_GOTREF(__pyx_t_2);
1345
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1346
__pyx_r = __pyx_t_2;
1347
__pyx_t_2 = 0;
1348
goto __pyx_L0;
1349
1350
/* "wrapper0.pyx":18
1351
* raise RuntimeError, "Error code %s"%err
1352
*
1353
* def __repr__(self): # <<<<<<<<<<<<<<
1354
* return "Smalljac curve defined by %s"%smalljac_Qcurve_str(self.c)
1355
*
1356
*/
1357
1358
/* function exit code */
1359
__pyx_L1_error:;
1360
__Pyx_XDECREF(__pyx_t_1);
1361
__Pyx_XDECREF(__pyx_t_2);
1362
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.SmallJac.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1363
__pyx_r = NULL;
1364
__pyx_L0:;
1365
__Pyx_XGIVEREF(__pyx_r);
1366
__Pyx_RefNannyFinishContext();
1367
return __pyx_r;
1368
}
1369
1370
/* "wrapper0.pyx":21
1371
* return "Smalljac curve defined by %s"%smalljac_Qcurve_str(self.c)
1372
*
1373
* def __dealloc__(self): # <<<<<<<<<<<<<<
1374
* if self.c:
1375
* smalljac_Qcurve_clear(self.c)
1376
*/
1377
1378
/* Python wrapper */
1379
static void __pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_7__dealloc__(PyObject *__pyx_v_self); /*proto*/
1380
static void __pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_7__dealloc__(PyObject *__pyx_v_self) {
1381
__Pyx_RefNannyDeclarations
1382
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
1383
__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_6__dealloc__(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_self));
1384
1385
/* function exit code */
1386
__Pyx_RefNannyFinishContext();
1387
}
1388
1389
static void __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_6__dealloc__(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self) {
1390
__Pyx_RefNannyDeclarations
1391
int __pyx_t_1;
1392
__Pyx_RefNannySetupContext("__dealloc__", 0);
1393
1394
/* "wrapper0.pyx":22
1395
*
1396
* def __dealloc__(self):
1397
* if self.c: # <<<<<<<<<<<<<<
1398
* smalljac_Qcurve_clear(self.c)
1399
*
1400
*/
1401
__pyx_t_1 = (__pyx_v_self->c != 0);
1402
if (__pyx_t_1) {
1403
1404
/* "wrapper0.pyx":23
1405
* def __dealloc__(self):
1406
* if self.c:
1407
* smalljac_Qcurve_clear(self.c) # <<<<<<<<<<<<<<
1408
*
1409
* cpdef int genus(self):
1410
*/
1411
smalljac_Qcurve_clear(__pyx_v_self->c);
1412
1413
/* "wrapper0.pyx":22
1414
*
1415
* def __dealloc__(self):
1416
* if self.c: # <<<<<<<<<<<<<<
1417
* smalljac_Qcurve_clear(self.c)
1418
*
1419
*/
1420
}
1421
1422
/* "wrapper0.pyx":21
1423
* return "Smalljac curve defined by %s"%smalljac_Qcurve_str(self.c)
1424
*
1425
* def __dealloc__(self): # <<<<<<<<<<<<<<
1426
* if self.c:
1427
* smalljac_Qcurve_clear(self.c)
1428
*/
1429
1430
/* function exit code */
1431
__Pyx_RefNannyFinishContext();
1432
}
1433
1434
/* "wrapper0.pyx":25
1435
* smalljac_Qcurve_clear(self.c)
1436
*
1437
* cpdef int genus(self): # <<<<<<<<<<<<<<
1438
* """
1439
* EXAMPLES::
1440
*/
1441
1442
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_9genus(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
1443
static int __pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_genus(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self, int __pyx_skip_dispatch) {
1444
int __pyx_r;
1445
__Pyx_RefNannyDeclarations
1446
PyObject *__pyx_t_1 = NULL;
1447
PyObject *__pyx_t_2 = NULL;
1448
PyObject *__pyx_t_3 = NULL;
1449
PyObject *__pyx_t_4 = NULL;
1450
int __pyx_t_5;
1451
__Pyx_RefNannySetupContext("genus", 0);
1452
/* Check if called by wrapper */
1453
if (unlikely(__pyx_skip_dispatch)) ;
1454
/* Check if overridden in Python */
1455
else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
1456
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_genus); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
1457
__Pyx_GOTREF(__pyx_t_1);
1458
if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_9genus)) {
1459
__Pyx_INCREF(__pyx_t_1);
1460
__pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
1461
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
1462
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
1463
if (likely(__pyx_t_4)) {
1464
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
1465
__Pyx_INCREF(__pyx_t_4);
1466
__Pyx_INCREF(function);
1467
__Pyx_DECREF_SET(__pyx_t_3, function);
1468
}
1469
}
1470
if (__pyx_t_4) {
1471
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
1472
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1473
} else {
1474
__pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
1475
}
1476
__Pyx_GOTREF(__pyx_t_2);
1477
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1478
__pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L1_error)
1479
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1480
__pyx_r = __pyx_t_5;
1481
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1482
goto __pyx_L0;
1483
}
1484
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1485
}
1486
1487
/* "wrapper0.pyx":43
1488
* RuntimeError: Error code -4
1489
* """
1490
* return smalljac_Qcurve_genus(self.c) # <<<<<<<<<<<<<<
1491
*
1492
* def ap(self, unsigned long p, unsigned long b=0):
1493
*/
1494
__pyx_r = smalljac_Qcurve_genus(__pyx_v_self->c);
1495
goto __pyx_L0;
1496
1497
/* "wrapper0.pyx":25
1498
* smalljac_Qcurve_clear(self.c)
1499
*
1500
* cpdef int genus(self): # <<<<<<<<<<<<<<
1501
* """
1502
* EXAMPLES::
1503
*/
1504
1505
/* function exit code */
1506
__pyx_L1_error:;
1507
__Pyx_XDECREF(__pyx_t_1);
1508
__Pyx_XDECREF(__pyx_t_2);
1509
__Pyx_XDECREF(__pyx_t_3);
1510
__Pyx_XDECREF(__pyx_t_4);
1511
__Pyx_WriteUnraisable("code.alex.psage.psage.libs.smalljac.wrapper2.SmallJac.genus", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
1512
__pyx_r = 0;
1513
__pyx_L0:;
1514
__Pyx_RefNannyFinishContext();
1515
return __pyx_r;
1516
}
1517
1518
/* Python wrapper */
1519
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_9genus(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
1520
static char __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_8genus[] = "File: wrapper0.pyx (starting at line 25)\n\n EXAMPLES::\n\n sage: import psage.libs.smalljac.wrapper as smalljac\n sage: smalljac.SmallJac('x^3+x+1').genus()\n 1\n sage: smalljac.SmallJac('x^5+x+1').genus()\n 2\n sage: smalljac.SmallJac('x^7+x+1').genus()\n 3\n sage: smalljac.SmallJac('x^9+x+1').genus()\n 4\n sage: smalljac.SmallJac('x^11+x+1').genus()\n Traceback (most recent call last):\n ...\n RuntimeError: Error code -4\n ";
1521
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_9genus(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
1522
PyObject *__pyx_r = 0;
1523
__Pyx_RefNannyDeclarations
1524
__Pyx_RefNannySetupContext("genus (wrapper)", 0);
1525
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_8genus(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_self));
1526
1527
/* function exit code */
1528
__Pyx_RefNannyFinishContext();
1529
return __pyx_r;
1530
}
1531
1532
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_8genus(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self) {
1533
PyObject *__pyx_r = NULL;
1534
__Pyx_RefNannyDeclarations
1535
PyObject *__pyx_t_1 = NULL;
1536
__Pyx_RefNannySetupContext("genus", 0);
1537
__Pyx_XDECREF(__pyx_r);
1538
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_genus(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
1539
__Pyx_GOTREF(__pyx_t_1);
1540
__pyx_r = __pyx_t_1;
1541
__pyx_t_1 = 0;
1542
goto __pyx_L0;
1543
1544
/* function exit code */
1545
__pyx_L1_error:;
1546
__Pyx_XDECREF(__pyx_t_1);
1547
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.SmallJac.genus", __pyx_clineno, __pyx_lineno, __pyx_filename);
1548
__pyx_r = NULL;
1549
__pyx_L0:;
1550
__Pyx_XGIVEREF(__pyx_r);
1551
__Pyx_RefNannyFinishContext();
1552
return __pyx_r;
1553
}
1554
1555
/* "wrapper0.pyx":45
1556
* return smalljac_Qcurve_genus(self.c)
1557
*
1558
* def ap(self, unsigned long p, unsigned long b=0): # <<<<<<<<<<<<<<
1559
* """
1560
* If only p is given, return trace of Frobenius at p. If both p
1561
*/
1562
1563
/* Python wrapper */
1564
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_11ap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1565
static char __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_10ap[] = "File: wrapper0.pyx (starting at line 45)\n\n If only p is given, return trace of Frobenius at p. If both p\n and b are given, return a dictionary of key:value pairs, with\n keys the primes < b, and values the traces of Frobenius at the\n good primes, and None at the bad primes, where bad is \"bad for\n the given model\".\n\n EXAMPLES::\n\n sage: import psage.libs.smalljac.wrapper as smalljac\n sage: C = smalljac.SmallJac(x^3 - 13392*x - 1080432)\n sage: C.ap(37)\n 3\n sage: C.ap(0,37)\n {2: None, 3: None, 5: 1, 7: -2, 11: None, 13: 4, 17: -2, 37: 3, 19: 0, 23: -1, 29: 0, 31: 7}\n sage: C.ap(19, 37)\n {31: 7, 37: 3, 19: 0, 29: 0, 23: -1}\n \n sage: C = smalljac.SmallJac(x^5 - 1)\n sage: C.ap(0,37)\n {2: None, 3: 0, 5: None, 7: 0, 11: -4, 13: 0, 17: 0, 37: 0, 19: 0, 23: 0, 29: 0, 31: -4}\n ";
1566
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_11ap(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1567
unsigned long __pyx_v_p;
1568
unsigned long __pyx_v_b;
1569
PyObject *__pyx_r = 0;
1570
__Pyx_RefNannyDeclarations
1571
__Pyx_RefNannySetupContext("ap (wrapper)", 0);
1572
{
1573
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_b,0};
1574
PyObject* values[2] = {0,0};
1575
if (unlikely(__pyx_kwds)) {
1576
Py_ssize_t kw_args;
1577
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1578
switch (pos_args) {
1579
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1580
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1581
case 0: break;
1582
default: goto __pyx_L5_argtuple_error;
1583
}
1584
kw_args = PyDict_Size(__pyx_kwds);
1585
switch (pos_args) {
1586
case 0:
1587
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
1588
else goto __pyx_L5_argtuple_error;
1589
case 1:
1590
if (kw_args > 0) {
1591
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b);
1592
if (value) { values[1] = value; kw_args--; }
1593
}
1594
}
1595
if (unlikely(kw_args > 0)) {
1596
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ap") < 0)) __PYX_ERR(0, 45, __pyx_L3_error)
1597
}
1598
} else {
1599
switch (PyTuple_GET_SIZE(__pyx_args)) {
1600
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1601
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1602
break;
1603
default: goto __pyx_L5_argtuple_error;
1604
}
1605
}
1606
__pyx_v_p = __Pyx_PyInt_As_unsigned_long(values[0]); if (unlikely((__pyx_v_p == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error)
1607
if (values[1]) {
1608
__pyx_v_b = __Pyx_PyInt_As_unsigned_long(values[1]); if (unlikely((__pyx_v_b == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error)
1609
} else {
1610
__pyx_v_b = ((unsigned long)0);
1611
}
1612
}
1613
goto __pyx_L4_argument_unpacking_done;
1614
__pyx_L5_argtuple_error:;
1615
__Pyx_RaiseArgtupleInvalid("ap", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 45, __pyx_L3_error)
1616
__pyx_L3_error:;
1617
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.SmallJac.ap", __pyx_clineno, __pyx_lineno, __pyx_filename);
1618
__Pyx_RefNannyFinishContext();
1619
return NULL;
1620
__pyx_L4_argument_unpacking_done:;
1621
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_10ap(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_self), __pyx_v_p, __pyx_v_b);
1622
1623
/* function exit code */
1624
__Pyx_RefNannyFinishContext();
1625
return __pyx_r;
1626
}
1627
1628
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_10ap(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self, unsigned long __pyx_v_p, unsigned long __pyx_v_b) {
1629
PyObject *__pyx_r = NULL;
1630
__Pyx_RefNannyDeclarations
1631
int __pyx_t_1;
1632
PyObject *__pyx_t_2 = NULL;
1633
__Pyx_RefNannySetupContext("ap", 0);
1634
1635
/* "wrapper0.pyx":68
1636
* {2: None, 3: 0, 5: None, 7: 0, 11: -4, 13: 0, 17: 0, 37: 0, 19: 0, 23: 0, 29: 0, 31: -4}
1637
* """
1638
* if b == 0: # <<<<<<<<<<<<<<
1639
* # Compute for a single p only
1640
* smalljac_Lpolys(self.c, p, p, SMALLJAC_A1_ONLY, callback_ap_single, <void*>self)
1641
*/
1642
__pyx_t_1 = ((__pyx_v_b == 0) != 0);
1643
if (__pyx_t_1) {
1644
1645
/* "wrapper0.pyx":70
1646
* if b == 0:
1647
* # Compute for a single p only
1648
* smalljac_Lpolys(self.c, p, p, SMALLJAC_A1_ONLY, callback_ap_single, <void*>self) # <<<<<<<<<<<<<<
1649
* return self.tmp
1650
* # Compute for a range of primes, starting with p.
1651
*/
1652
smalljac_Lpolys(__pyx_v_self->c, __pyx_v_p, __pyx_v_p, SMALLJAC_A1_ONLY, __pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_callback_ap_single, ((void *)__pyx_v_self));
1653
1654
/* "wrapper0.pyx":71
1655
* # Compute for a single p only
1656
* smalljac_Lpolys(self.c, p, p, SMALLJAC_A1_ONLY, callback_ap_single, <void*>self)
1657
* return self.tmp # <<<<<<<<<<<<<<
1658
* # Compute for a range of primes, starting with p.
1659
* self.tmp = {}
1660
*/
1661
__Pyx_XDECREF(__pyx_r);
1662
__Pyx_INCREF(__pyx_v_self->tmp);
1663
__pyx_r = __pyx_v_self->tmp;
1664
goto __pyx_L0;
1665
1666
/* "wrapper0.pyx":68
1667
* {2: None, 3: 0, 5: None, 7: 0, 11: -4, 13: 0, 17: 0, 37: 0, 19: 0, 23: 0, 29: 0, 31: -4}
1668
* """
1669
* if b == 0: # <<<<<<<<<<<<<<
1670
* # Compute for a single p only
1671
* smalljac_Lpolys(self.c, p, p, SMALLJAC_A1_ONLY, callback_ap_single, <void*>self)
1672
*/
1673
}
1674
1675
/* "wrapper0.pyx":73
1676
* return self.tmp
1677
* # Compute for a range of primes, starting with p.
1678
* self.tmp = {} # <<<<<<<<<<<<<<
1679
* smalljac_Lpolys(self.c, p, b, SMALLJAC_A1_ONLY, callback_ap_dict, <void*>self)
1680
* return self.tmp
1681
*/
1682
__pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error)
1683
__Pyx_GOTREF(__pyx_t_2);
1684
__Pyx_GIVEREF(__pyx_t_2);
1685
__Pyx_GOTREF(__pyx_v_self->tmp);
1686
__Pyx_DECREF(__pyx_v_self->tmp);
1687
__pyx_v_self->tmp = __pyx_t_2;
1688
__pyx_t_2 = 0;
1689
1690
/* "wrapper0.pyx":74
1691
* # Compute for a range of primes, starting with p.
1692
* self.tmp = {}
1693
* smalljac_Lpolys(self.c, p, b, SMALLJAC_A1_ONLY, callback_ap_dict, <void*>self) # <<<<<<<<<<<<<<
1694
* return self.tmp
1695
*
1696
*/
1697
smalljac_Lpolys(__pyx_v_self->c, __pyx_v_p, __pyx_v_b, SMALLJAC_A1_ONLY, __pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_callback_ap_dict, ((void *)__pyx_v_self));
1698
1699
/* "wrapper0.pyx":75
1700
* self.tmp = {}
1701
* smalljac_Lpolys(self.c, p, b, SMALLJAC_A1_ONLY, callback_ap_dict, <void*>self)
1702
* return self.tmp # <<<<<<<<<<<<<<
1703
*
1704
* def frob(self, unsigned long p, unsigned long b=0):
1705
*/
1706
__Pyx_XDECREF(__pyx_r);
1707
__Pyx_INCREF(__pyx_v_self->tmp);
1708
__pyx_r = __pyx_v_self->tmp;
1709
goto __pyx_L0;
1710
1711
/* "wrapper0.pyx":45
1712
* return smalljac_Qcurve_genus(self.c)
1713
*
1714
* def ap(self, unsigned long p, unsigned long b=0): # <<<<<<<<<<<<<<
1715
* """
1716
* If only p is given, return trace of Frobenius at p. If both p
1717
*/
1718
1719
/* function exit code */
1720
__pyx_L1_error:;
1721
__Pyx_XDECREF(__pyx_t_2);
1722
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.SmallJac.ap", __pyx_clineno, __pyx_lineno, __pyx_filename);
1723
__pyx_r = NULL;
1724
__pyx_L0:;
1725
__Pyx_XGIVEREF(__pyx_r);
1726
__Pyx_RefNannyFinishContext();
1727
return __pyx_r;
1728
}
1729
1730
/* "wrapper0.pyx":77
1731
* return self.tmp
1732
*
1733
* def frob(self, unsigned long p, unsigned long b=0): # <<<<<<<<<<<<<<
1734
* """
1735
* EXAMPLES::
1736
*/
1737
1738
/* Python wrapper */
1739
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_13frob(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1740
static char __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_12frob[] = "File: wrapper0.pyx (starting at line 77)\n\n EXAMPLES::\n ";
1741
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_13frob(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1742
unsigned long __pyx_v_p;
1743
unsigned long __pyx_v_b;
1744
PyObject *__pyx_r = 0;
1745
__Pyx_RefNannyDeclarations
1746
__Pyx_RefNannySetupContext("frob (wrapper)", 0);
1747
{
1748
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_b,0};
1749
PyObject* values[2] = {0,0};
1750
if (unlikely(__pyx_kwds)) {
1751
Py_ssize_t kw_args;
1752
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1753
switch (pos_args) {
1754
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1755
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1756
case 0: break;
1757
default: goto __pyx_L5_argtuple_error;
1758
}
1759
kw_args = PyDict_Size(__pyx_kwds);
1760
switch (pos_args) {
1761
case 0:
1762
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
1763
else goto __pyx_L5_argtuple_error;
1764
case 1:
1765
if (kw_args > 0) {
1766
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b);
1767
if (value) { values[1] = value; kw_args--; }
1768
}
1769
}
1770
if (unlikely(kw_args > 0)) {
1771
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "frob") < 0)) __PYX_ERR(0, 77, __pyx_L3_error)
1772
}
1773
} else {
1774
switch (PyTuple_GET_SIZE(__pyx_args)) {
1775
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1776
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1777
break;
1778
default: goto __pyx_L5_argtuple_error;
1779
}
1780
}
1781
__pyx_v_p = __Pyx_PyInt_As_unsigned_long(values[0]); if (unlikely((__pyx_v_p == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 77, __pyx_L3_error)
1782
if (values[1]) {
1783
__pyx_v_b = __Pyx_PyInt_As_unsigned_long(values[1]); if (unlikely((__pyx_v_b == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 77, __pyx_L3_error)
1784
} else {
1785
__pyx_v_b = ((unsigned long)0);
1786
}
1787
}
1788
goto __pyx_L4_argument_unpacking_done;
1789
__pyx_L5_argtuple_error:;
1790
__Pyx_RaiseArgtupleInvalid("frob", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 77, __pyx_L3_error)
1791
__pyx_L3_error:;
1792
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.SmallJac.frob", __pyx_clineno, __pyx_lineno, __pyx_filename);
1793
__Pyx_RefNannyFinishContext();
1794
return NULL;
1795
__pyx_L4_argument_unpacking_done:;
1796
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_12frob(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_self), __pyx_v_p, __pyx_v_b);
1797
1798
/* function exit code */
1799
__Pyx_RefNannyFinishContext();
1800
return __pyx_r;
1801
}
1802
1803
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_12frob(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self, unsigned long __pyx_v_p, unsigned long __pyx_v_b) {
1804
PyObject *__pyx_r = NULL;
1805
__Pyx_RefNannyDeclarations
1806
int __pyx_t_1;
1807
PyObject *__pyx_t_2 = NULL;
1808
__Pyx_RefNannySetupContext("frob", 0);
1809
1810
/* "wrapper0.pyx":81
1811
* EXAMPLES::
1812
* """
1813
* if b == 0: # <<<<<<<<<<<<<<
1814
* # Compute for a single p only
1815
* smalljac_Lpolys(self.c, p, p, 0, callback_Lpolys_single, <void*>self)
1816
*/
1817
__pyx_t_1 = ((__pyx_v_b == 0) != 0);
1818
if (__pyx_t_1) {
1819
1820
/* "wrapper0.pyx":83
1821
* if b == 0:
1822
* # Compute for a single p only
1823
* smalljac_Lpolys(self.c, p, p, 0, callback_Lpolys_single, <void*>self) # <<<<<<<<<<<<<<
1824
* return self.tmp
1825
* self.tmp = {}
1826
*/
1827
smalljac_Lpolys(__pyx_v_self->c, __pyx_v_p, __pyx_v_p, 0, __pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_callback_Lpolys_single, ((void *)__pyx_v_self));
1828
1829
/* "wrapper0.pyx":84
1830
* # Compute for a single p only
1831
* smalljac_Lpolys(self.c, p, p, 0, callback_Lpolys_single, <void*>self)
1832
* return self.tmp # <<<<<<<<<<<<<<
1833
* self.tmp = {}
1834
* smalljac_Lpolys(self.c, p, b, 0, callback_Lpolys, <void*>self)
1835
*/
1836
__Pyx_XDECREF(__pyx_r);
1837
__Pyx_INCREF(__pyx_v_self->tmp);
1838
__pyx_r = __pyx_v_self->tmp;
1839
goto __pyx_L0;
1840
1841
/* "wrapper0.pyx":81
1842
* EXAMPLES::
1843
* """
1844
* if b == 0: # <<<<<<<<<<<<<<
1845
* # Compute for a single p only
1846
* smalljac_Lpolys(self.c, p, p, 0, callback_Lpolys_single, <void*>self)
1847
*/
1848
}
1849
1850
/* "wrapper0.pyx":85
1851
* smalljac_Lpolys(self.c, p, p, 0, callback_Lpolys_single, <void*>self)
1852
* return self.tmp
1853
* self.tmp = {} # <<<<<<<<<<<<<<
1854
* smalljac_Lpolys(self.c, p, b, 0, callback_Lpolys, <void*>self)
1855
* return self.tmp
1856
*/
1857
__pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
1858
__Pyx_GOTREF(__pyx_t_2);
1859
__Pyx_GIVEREF(__pyx_t_2);
1860
__Pyx_GOTREF(__pyx_v_self->tmp);
1861
__Pyx_DECREF(__pyx_v_self->tmp);
1862
__pyx_v_self->tmp = __pyx_t_2;
1863
__pyx_t_2 = 0;
1864
1865
/* "wrapper0.pyx":86
1866
* return self.tmp
1867
* self.tmp = {}
1868
* smalljac_Lpolys(self.c, p, b, 0, callback_Lpolys, <void*>self) # <<<<<<<<<<<<<<
1869
* return self.tmp
1870
*
1871
*/
1872
smalljac_Lpolys(__pyx_v_self->c, __pyx_v_p, __pyx_v_b, 0, __pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_callback_Lpolys, ((void *)__pyx_v_self));
1873
1874
/* "wrapper0.pyx":87
1875
* self.tmp = {}
1876
* smalljac_Lpolys(self.c, p, b, 0, callback_Lpolys, <void*>self)
1877
* return self.tmp # <<<<<<<<<<<<<<
1878
*
1879
* def group(self, unsigned long p, unsigned long b=0):
1880
*/
1881
__Pyx_XDECREF(__pyx_r);
1882
__Pyx_INCREF(__pyx_v_self->tmp);
1883
__pyx_r = __pyx_v_self->tmp;
1884
goto __pyx_L0;
1885
1886
/* "wrapper0.pyx":77
1887
* return self.tmp
1888
*
1889
* def frob(self, unsigned long p, unsigned long b=0): # <<<<<<<<<<<<<<
1890
* """
1891
* EXAMPLES::
1892
*/
1893
1894
/* function exit code */
1895
__pyx_L1_error:;
1896
__Pyx_XDECREF(__pyx_t_2);
1897
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.SmallJac.frob", __pyx_clineno, __pyx_lineno, __pyx_filename);
1898
__pyx_r = NULL;
1899
__pyx_L0:;
1900
__Pyx_XGIVEREF(__pyx_r);
1901
__Pyx_RefNannyFinishContext();
1902
return __pyx_r;
1903
}
1904
1905
/* "wrapper0.pyx":89
1906
* return self.tmp
1907
*
1908
* def group(self, unsigned long p, unsigned long b=0): # <<<<<<<<<<<<<<
1909
* raise NotImplementedError
1910
*
1911
*/
1912
1913
/* Python wrapper */
1914
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_15group(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1915
static char __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_14group[] = "File: wrapper0.pyx (starting at line 89)";
1916
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_15group(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1917
CYTHON_UNUSED unsigned long __pyx_v_p;
1918
CYTHON_UNUSED unsigned long __pyx_v_b;
1919
PyObject *__pyx_r = 0;
1920
__Pyx_RefNannyDeclarations
1921
__Pyx_RefNannySetupContext("group (wrapper)", 0);
1922
{
1923
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_p,&__pyx_n_s_b,0};
1924
PyObject* values[2] = {0,0};
1925
if (unlikely(__pyx_kwds)) {
1926
Py_ssize_t kw_args;
1927
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1928
switch (pos_args) {
1929
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1930
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1931
case 0: break;
1932
default: goto __pyx_L5_argtuple_error;
1933
}
1934
kw_args = PyDict_Size(__pyx_kwds);
1935
switch (pos_args) {
1936
case 0:
1937
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
1938
else goto __pyx_L5_argtuple_error;
1939
case 1:
1940
if (kw_args > 0) {
1941
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b);
1942
if (value) { values[1] = value; kw_args--; }
1943
}
1944
}
1945
if (unlikely(kw_args > 0)) {
1946
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "group") < 0)) __PYX_ERR(0, 89, __pyx_L3_error)
1947
}
1948
} else {
1949
switch (PyTuple_GET_SIZE(__pyx_args)) {
1950
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
1951
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1952
break;
1953
default: goto __pyx_L5_argtuple_error;
1954
}
1955
}
1956
__pyx_v_p = __Pyx_PyInt_As_unsigned_long(values[0]); if (unlikely((__pyx_v_p == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L3_error)
1957
if (values[1]) {
1958
__pyx_v_b = __Pyx_PyInt_As_unsigned_long(values[1]); if (unlikely((__pyx_v_b == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L3_error)
1959
} else {
1960
__pyx_v_b = ((unsigned long)0);
1961
}
1962
}
1963
goto __pyx_L4_argument_unpacking_done;
1964
__pyx_L5_argtuple_error:;
1965
__Pyx_RaiseArgtupleInvalid("group", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 89, __pyx_L3_error)
1966
__pyx_L3_error:;
1967
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.SmallJac.group", __pyx_clineno, __pyx_lineno, __pyx_filename);
1968
__Pyx_RefNannyFinishContext();
1969
return NULL;
1970
__pyx_L4_argument_unpacking_done:;
1971
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_14group(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_self), __pyx_v_p, __pyx_v_b);
1972
1973
/* function exit code */
1974
__Pyx_RefNannyFinishContext();
1975
return __pyx_r;
1976
}
1977
1978
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_14group(CYTHON_UNUSED struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *__pyx_v_self, CYTHON_UNUSED unsigned long __pyx_v_p, CYTHON_UNUSED unsigned long __pyx_v_b) {
1979
PyObject *__pyx_r = NULL;
1980
__Pyx_RefNannyDeclarations
1981
__Pyx_RefNannySetupContext("group", 0);
1982
1983
/* "wrapper0.pyx":90
1984
*
1985
* def group(self, unsigned long p, unsigned long b=0):
1986
* raise NotImplementedError # <<<<<<<<<<<<<<
1987
*
1988
*
1989
*/
1990
__Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
1991
__PYX_ERR(0, 90, __pyx_L1_error)
1992
1993
/* "wrapper0.pyx":89
1994
* return self.tmp
1995
*
1996
* def group(self, unsigned long p, unsigned long b=0): # <<<<<<<<<<<<<<
1997
* raise NotImplementedError
1998
*
1999
*/
2000
2001
/* function exit code */
2002
__pyx_L1_error:;
2003
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.SmallJac.group", __pyx_clineno, __pyx_lineno, __pyx_filename);
2004
__pyx_r = NULL;
2005
__Pyx_XGIVEREF(__pyx_r);
2006
__Pyx_RefNannyFinishContext();
2007
return __pyx_r;
2008
}
2009
2010
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":11
2011
* cdef long a0, a1
2012
* cdef unsigned long p
2013
* def __init__(self, a0, a1, p): # <<<<<<<<<<<<<<
2014
* self.a0 = a0
2015
* self.a1 = a1
2016
*/
2017
2018
/* Python wrapper */
2019
static int __pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2020
static char __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly___init__[] = "File: wrapper2.pyx (starting at line 11)";
2021
#if CYTHON_COMPILING_IN_CPYTHON
2022
struct wrapperbase __pyx_wrapperbase_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly___init__;
2023
#endif
2024
static int __pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2025
PyObject *__pyx_v_a0 = 0;
2026
PyObject *__pyx_v_a1 = 0;
2027
PyObject *__pyx_v_p = 0;
2028
int __pyx_r;
2029
__Pyx_RefNannyDeclarations
2030
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
2031
{
2032
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a0,&__pyx_n_s_a1,&__pyx_n_s_p,0};
2033
PyObject* values[3] = {0,0,0};
2034
if (unlikely(__pyx_kwds)) {
2035
Py_ssize_t kw_args;
2036
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2037
switch (pos_args) {
2038
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2039
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2040
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2041
case 0: break;
2042
default: goto __pyx_L5_argtuple_error;
2043
}
2044
kw_args = PyDict_Size(__pyx_kwds);
2045
switch (pos_args) {
2046
case 0:
2047
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a0)) != 0)) kw_args--;
2048
else goto __pyx_L5_argtuple_error;
2049
case 1:
2050
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a1)) != 0)) kw_args--;
2051
else {
2052
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(1, 11, __pyx_L3_error)
2053
}
2054
case 2:
2055
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
2056
else {
2057
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(1, 11, __pyx_L3_error)
2058
}
2059
}
2060
if (unlikely(kw_args > 0)) {
2061
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 11, __pyx_L3_error)
2062
}
2063
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2064
goto __pyx_L5_argtuple_error;
2065
} else {
2066
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2067
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2068
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2069
}
2070
__pyx_v_a0 = values[0];
2071
__pyx_v_a1 = values[1];
2072
__pyx_v_p = values[2];
2073
}
2074
goto __pyx_L4_argument_unpacking_done;
2075
__pyx_L5_argtuple_error:;
2076
__Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 11, __pyx_L3_error)
2077
__pyx_L3_error:;
2078
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.FrobPoly.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2079
__Pyx_RefNannyFinishContext();
2080
return -1;
2081
__pyx_L4_argument_unpacking_done:;
2082
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly___init__(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *)__pyx_v_self), __pyx_v_a0, __pyx_v_a1, __pyx_v_p);
2083
2084
/* function exit code */
2085
__Pyx_RefNannyFinishContext();
2086
return __pyx_r;
2087
}
2088
2089
static int __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly___init__(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *__pyx_v_self, PyObject *__pyx_v_a0, PyObject *__pyx_v_a1, PyObject *__pyx_v_p) {
2090
int __pyx_r;
2091
__Pyx_RefNannyDeclarations
2092
long __pyx_t_1;
2093
unsigned long __pyx_t_2;
2094
__Pyx_RefNannySetupContext("__init__", 0);
2095
2096
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":12
2097
* cdef unsigned long p
2098
* def __init__(self, a0, a1, p):
2099
* self.a0 = a0 # <<<<<<<<<<<<<<
2100
* self.a1 = a1
2101
* self.p = p
2102
*/
2103
__pyx_t_1 = __Pyx_PyInt_As_long(__pyx_v_a0); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error)
2104
__pyx_v_self->a0 = __pyx_t_1;
2105
2106
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":13
2107
* def __init__(self, a0, a1, p):
2108
* self.a0 = a0
2109
* self.a1 = a1 # <<<<<<<<<<<<<<
2110
* self.p = p
2111
*
2112
*/
2113
__pyx_t_1 = __Pyx_PyInt_As_long(__pyx_v_a1); if (unlikely((__pyx_t_1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 13, __pyx_L1_error)
2114
__pyx_v_self->a1 = __pyx_t_1;
2115
2116
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":14
2117
* self.a0 = a0
2118
* self.a1 = a1
2119
* self.p = p # <<<<<<<<<<<<<<
2120
*
2121
* def __reduce__(self):
2122
*/
2123
__pyx_t_2 = __Pyx_PyInt_As_unsigned_long(__pyx_v_p); if (unlikely((__pyx_t_2 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(1, 14, __pyx_L1_error)
2124
__pyx_v_self->p = __pyx_t_2;
2125
2126
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":11
2127
* cdef long a0, a1
2128
* cdef unsigned long p
2129
* def __init__(self, a0, a1, p): # <<<<<<<<<<<<<<
2130
* self.a0 = a0
2131
* self.a1 = a1
2132
*/
2133
2134
/* function exit code */
2135
__pyx_r = 0;
2136
goto __pyx_L0;
2137
__pyx_L1_error:;
2138
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.FrobPoly.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2139
__pyx_r = -1;
2140
__pyx_L0:;
2141
__Pyx_RefNannyFinishContext();
2142
return __pyx_r;
2143
}
2144
2145
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":16
2146
* self.p = p
2147
*
2148
* def __reduce__(self): # <<<<<<<<<<<<<<
2149
* return FrobPoly_new, (self.a0, self.a1, self.p)
2150
*
2151
*/
2152
2153
/* Python wrapper */
2154
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2155
static char __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_2__reduce__[] = "File: wrapper2.pyx (starting at line 16)";
2156
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2157
PyObject *__pyx_r = 0;
2158
__Pyx_RefNannyDeclarations
2159
__Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0);
2160
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_2__reduce__(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *)__pyx_v_self));
2161
2162
/* function exit code */
2163
__Pyx_RefNannyFinishContext();
2164
return __pyx_r;
2165
}
2166
2167
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_2__reduce__(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *__pyx_v_self) {
2168
PyObject *__pyx_r = NULL;
2169
__Pyx_RefNannyDeclarations
2170
PyObject *__pyx_t_1 = NULL;
2171
PyObject *__pyx_t_2 = NULL;
2172
PyObject *__pyx_t_3 = NULL;
2173
PyObject *__pyx_t_4 = NULL;
2174
PyObject *__pyx_t_5 = NULL;
2175
__Pyx_RefNannySetupContext("__reduce__", 0);
2176
2177
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":17
2178
*
2179
* def __reduce__(self):
2180
* return FrobPoly_new, (self.a0, self.a1, self.p) # <<<<<<<<<<<<<<
2181
*
2182
* def __repr__(self):
2183
*/
2184
__Pyx_XDECREF(__pyx_r);
2185
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_FrobPoly_new); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
2186
__Pyx_GOTREF(__pyx_t_1);
2187
__pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_self->a0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error)
2188
__Pyx_GOTREF(__pyx_t_2);
2189
__pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_self->a1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 17, __pyx_L1_error)
2190
__Pyx_GOTREF(__pyx_t_3);
2191
__pyx_t_4 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->p); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 17, __pyx_L1_error)
2192
__Pyx_GOTREF(__pyx_t_4);
2193
__pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 17, __pyx_L1_error)
2194
__Pyx_GOTREF(__pyx_t_5);
2195
__Pyx_GIVEREF(__pyx_t_2);
2196
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
2197
__Pyx_GIVEREF(__pyx_t_3);
2198
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
2199
__Pyx_GIVEREF(__pyx_t_4);
2200
PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
2201
__pyx_t_2 = 0;
2202
__pyx_t_3 = 0;
2203
__pyx_t_4 = 0;
2204
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 17, __pyx_L1_error)
2205
__Pyx_GOTREF(__pyx_t_4);
2206
__Pyx_GIVEREF(__pyx_t_1);
2207
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
2208
__Pyx_GIVEREF(__pyx_t_5);
2209
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
2210
__pyx_t_1 = 0;
2211
__pyx_t_5 = 0;
2212
__pyx_r = __pyx_t_4;
2213
__pyx_t_4 = 0;
2214
goto __pyx_L0;
2215
2216
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":16
2217
* self.p = p
2218
*
2219
* def __reduce__(self): # <<<<<<<<<<<<<<
2220
* return FrobPoly_new, (self.a0, self.a1, self.p)
2221
*
2222
*/
2223
2224
/* function exit code */
2225
__pyx_L1_error:;
2226
__Pyx_XDECREF(__pyx_t_1);
2227
__Pyx_XDECREF(__pyx_t_2);
2228
__Pyx_XDECREF(__pyx_t_3);
2229
__Pyx_XDECREF(__pyx_t_4);
2230
__Pyx_XDECREF(__pyx_t_5);
2231
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.FrobPoly.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2232
__pyx_r = NULL;
2233
__pyx_L0:;
2234
__Pyx_XGIVEREF(__pyx_r);
2235
__Pyx_RefNannyFinishContext();
2236
return __pyx_r;
2237
}
2238
2239
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":19
2240
* return FrobPoly_new, (self.a0, self.a1, self.p)
2241
*
2242
* def __repr__(self): # <<<<<<<<<<<<<<
2243
* return "Frobenius in characteristic %s with charpoly %s"%(self.p, self.characteristic_polynomial())
2244
*
2245
*/
2246
2247
/* Python wrapper */
2248
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_5__repr__(PyObject *__pyx_v_self); /*proto*/
2249
static char __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_4__repr__[] = "File: wrapper2.pyx (starting at line 19)";
2250
#if CYTHON_COMPILING_IN_CPYTHON
2251
struct wrapperbase __pyx_wrapperbase_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_4__repr__;
2252
#endif
2253
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_5__repr__(PyObject *__pyx_v_self) {
2254
PyObject *__pyx_r = 0;
2255
__Pyx_RefNannyDeclarations
2256
__Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
2257
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_4__repr__(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *)__pyx_v_self));
2258
2259
/* function exit code */
2260
__Pyx_RefNannyFinishContext();
2261
return __pyx_r;
2262
}
2263
2264
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_4__repr__(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *__pyx_v_self) {
2265
PyObject *__pyx_r = NULL;
2266
__Pyx_RefNannyDeclarations
2267
PyObject *__pyx_t_1 = NULL;
2268
PyObject *__pyx_t_2 = NULL;
2269
PyObject *__pyx_t_3 = NULL;
2270
PyObject *__pyx_t_4 = NULL;
2271
__Pyx_RefNannySetupContext("__repr__", 0);
2272
2273
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":20
2274
*
2275
* def __repr__(self):
2276
* return "Frobenius in characteristic %s with charpoly %s"%(self.p, self.characteristic_polynomial()) # <<<<<<<<<<<<<<
2277
*
2278
* def prime(self):
2279
*/
2280
__Pyx_XDECREF(__pyx_r);
2281
__pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->p); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 20, __pyx_L1_error)
2282
__Pyx_GOTREF(__pyx_t_1);
2283
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_characteristic_polynomial); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 20, __pyx_L1_error)
2284
__Pyx_GOTREF(__pyx_t_3);
2285
__pyx_t_4 = NULL;
2286
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
2287
__pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
2288
if (likely(__pyx_t_4)) {
2289
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
2290
__Pyx_INCREF(__pyx_t_4);
2291
__Pyx_INCREF(function);
2292
__Pyx_DECREF_SET(__pyx_t_3, function);
2293
}
2294
}
2295
if (__pyx_t_4) {
2296
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 20, __pyx_L1_error)
2297
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2298
} else {
2299
__pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 20, __pyx_L1_error)
2300
}
2301
__Pyx_GOTREF(__pyx_t_2);
2302
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2303
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 20, __pyx_L1_error)
2304
__Pyx_GOTREF(__pyx_t_3);
2305
__Pyx_GIVEREF(__pyx_t_1);
2306
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
2307
__Pyx_GIVEREF(__pyx_t_2);
2308
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
2309
__pyx_t_1 = 0;
2310
__pyx_t_2 = 0;
2311
__pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Frobenius_in_characteristic_s_wi, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 20, __pyx_L1_error)
2312
__Pyx_GOTREF(__pyx_t_2);
2313
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2314
__pyx_r = __pyx_t_2;
2315
__pyx_t_2 = 0;
2316
goto __pyx_L0;
2317
2318
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":19
2319
* return FrobPoly_new, (self.a0, self.a1, self.p)
2320
*
2321
* def __repr__(self): # <<<<<<<<<<<<<<
2322
* return "Frobenius in characteristic %s with charpoly %s"%(self.p, self.characteristic_polynomial())
2323
*
2324
*/
2325
2326
/* function exit code */
2327
__pyx_L1_error:;
2328
__Pyx_XDECREF(__pyx_t_1);
2329
__Pyx_XDECREF(__pyx_t_2);
2330
__Pyx_XDECREF(__pyx_t_3);
2331
__Pyx_XDECREF(__pyx_t_4);
2332
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.FrobPoly.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2333
__pyx_r = NULL;
2334
__pyx_L0:;
2335
__Pyx_XGIVEREF(__pyx_r);
2336
__Pyx_RefNannyFinishContext();
2337
return __pyx_r;
2338
}
2339
2340
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":22
2341
* return "Frobenius in characteristic %s with charpoly %s"%(self.p, self.characteristic_polynomial())
2342
*
2343
* def prime(self): # <<<<<<<<<<<<<<
2344
* return int(self.p)
2345
*
2346
*/
2347
2348
/* Python wrapper */
2349
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_7prime(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2350
static char __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_6prime[] = "File: wrapper2.pyx (starting at line 22)";
2351
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_7prime(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2352
PyObject *__pyx_r = 0;
2353
__Pyx_RefNannyDeclarations
2354
__Pyx_RefNannySetupContext("prime (wrapper)", 0);
2355
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_6prime(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *)__pyx_v_self));
2356
2357
/* function exit code */
2358
__Pyx_RefNannyFinishContext();
2359
return __pyx_r;
2360
}
2361
2362
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_6prime(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *__pyx_v_self) {
2363
PyObject *__pyx_r = NULL;
2364
__Pyx_RefNannyDeclarations
2365
PyObject *__pyx_t_1 = NULL;
2366
PyObject *__pyx_t_2 = NULL;
2367
__Pyx_RefNannySetupContext("prime", 0);
2368
2369
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":23
2370
*
2371
* def prime(self):
2372
* return int(self.p) # <<<<<<<<<<<<<<
2373
*
2374
* def trace(self):
2375
*/
2376
__Pyx_XDECREF(__pyx_r);
2377
__pyx_t_1 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->p); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 23, __pyx_L1_error)
2378
__Pyx_GOTREF(__pyx_t_1);
2379
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 23, __pyx_L1_error)
2380
__Pyx_GOTREF(__pyx_t_2);
2381
__Pyx_GIVEREF(__pyx_t_1);
2382
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
2383
__pyx_t_1 = 0;
2384
__pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyInt_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 23, __pyx_L1_error)
2385
__Pyx_GOTREF(__pyx_t_1);
2386
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2387
__pyx_r = __pyx_t_1;
2388
__pyx_t_1 = 0;
2389
goto __pyx_L0;
2390
2391
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":22
2392
* return "Frobenius in characteristic %s with charpoly %s"%(self.p, self.characteristic_polynomial())
2393
*
2394
* def prime(self): # <<<<<<<<<<<<<<
2395
* return int(self.p)
2396
*
2397
*/
2398
2399
/* function exit code */
2400
__pyx_L1_error:;
2401
__Pyx_XDECREF(__pyx_t_1);
2402
__Pyx_XDECREF(__pyx_t_2);
2403
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.FrobPoly.prime", __pyx_clineno, __pyx_lineno, __pyx_filename);
2404
__pyx_r = NULL;
2405
__pyx_L0:;
2406
__Pyx_XGIVEREF(__pyx_r);
2407
__Pyx_RefNannyFinishContext();
2408
return __pyx_r;
2409
}
2410
2411
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":25
2412
* return int(self.p)
2413
*
2414
* def trace(self): # <<<<<<<<<<<<<<
2415
* return -self.a0
2416
*
2417
*/
2418
2419
/* Python wrapper */
2420
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_9trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2421
static char __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_8trace[] = "File: wrapper2.pyx (starting at line 25)";
2422
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_9trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2423
PyObject *__pyx_r = 0;
2424
__Pyx_RefNannyDeclarations
2425
__Pyx_RefNannySetupContext("trace (wrapper)", 0);
2426
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_8trace(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *)__pyx_v_self));
2427
2428
/* function exit code */
2429
__Pyx_RefNannyFinishContext();
2430
return __pyx_r;
2431
}
2432
2433
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_8trace(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *__pyx_v_self) {
2434
PyObject *__pyx_r = NULL;
2435
__Pyx_RefNannyDeclarations
2436
PyObject *__pyx_t_1 = NULL;
2437
__Pyx_RefNannySetupContext("trace", 0);
2438
2439
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":26
2440
*
2441
* def trace(self):
2442
* return -self.a0 # <<<<<<<<<<<<<<
2443
*
2444
* def characteristic_polynomial(self, var='x'):
2445
*/
2446
__Pyx_XDECREF(__pyx_r);
2447
__pyx_t_1 = __Pyx_PyInt_From_long((-__pyx_v_self->a0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 26, __pyx_L1_error)
2448
__Pyx_GOTREF(__pyx_t_1);
2449
__pyx_r = __pyx_t_1;
2450
__pyx_t_1 = 0;
2451
goto __pyx_L0;
2452
2453
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":25
2454
* return int(self.p)
2455
*
2456
* def trace(self): # <<<<<<<<<<<<<<
2457
* return -self.a0
2458
*
2459
*/
2460
2461
/* function exit code */
2462
__pyx_L1_error:;
2463
__Pyx_XDECREF(__pyx_t_1);
2464
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.FrobPoly.trace", __pyx_clineno, __pyx_lineno, __pyx_filename);
2465
__pyx_r = NULL;
2466
__pyx_L0:;
2467
__Pyx_XGIVEREF(__pyx_r);
2468
__Pyx_RefNannyFinishContext();
2469
return __pyx_r;
2470
}
2471
2472
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":28
2473
* return -self.a0
2474
*
2475
* def characteristic_polynomial(self, var='x'): # <<<<<<<<<<<<<<
2476
* from sage.rings.all import ZZ
2477
* p = int(self.p)
2478
*/
2479
2480
/* Python wrapper */
2481
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_11characteristic_polynomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2482
static char __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_10characteristic_polynomial[] = "File: wrapper2.pyx (starting at line 28)";
2483
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_11characteristic_polynomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2484
PyObject *__pyx_v_var = 0;
2485
PyObject *__pyx_r = 0;
2486
__Pyx_RefNannyDeclarations
2487
__Pyx_RefNannySetupContext("characteristic_polynomial (wrapper)", 0);
2488
{
2489
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_var,0};
2490
PyObject* values[1] = {0};
2491
values[0] = ((PyObject *)__pyx_n_s_x);
2492
if (unlikely(__pyx_kwds)) {
2493
Py_ssize_t kw_args;
2494
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2495
switch (pos_args) {
2496
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2497
case 0: break;
2498
default: goto __pyx_L5_argtuple_error;
2499
}
2500
kw_args = PyDict_Size(__pyx_kwds);
2501
switch (pos_args) {
2502
case 0:
2503
if (kw_args > 0) {
2504
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_var);
2505
if (value) { values[0] = value; kw_args--; }
2506
}
2507
}
2508
if (unlikely(kw_args > 0)) {
2509
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "characteristic_polynomial") < 0)) __PYX_ERR(1, 28, __pyx_L3_error)
2510
}
2511
} else {
2512
switch (PyTuple_GET_SIZE(__pyx_args)) {
2513
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2514
case 0: break;
2515
default: goto __pyx_L5_argtuple_error;
2516
}
2517
}
2518
__pyx_v_var = values[0];
2519
}
2520
goto __pyx_L4_argument_unpacking_done;
2521
__pyx_L5_argtuple_error:;
2522
__Pyx_RaiseArgtupleInvalid("characteristic_polynomial", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 28, __pyx_L3_error)
2523
__pyx_L3_error:;
2524
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.FrobPoly.characteristic_polynomial", __pyx_clineno, __pyx_lineno, __pyx_filename);
2525
__Pyx_RefNannyFinishContext();
2526
return NULL;
2527
__pyx_L4_argument_unpacking_done:;
2528
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_10characteristic_polynomial(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *)__pyx_v_self), __pyx_v_var);
2529
2530
/* function exit code */
2531
__Pyx_RefNannyFinishContext();
2532
return __pyx_r;
2533
}
2534
2535
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_10characteristic_polynomial(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *__pyx_v_self, PyObject *__pyx_v_var) {
2536
PyObject *__pyx_v_ZZ = NULL;
2537
PyObject *__pyx_v_p = NULL;
2538
PyObject *__pyx_r = NULL;
2539
__Pyx_RefNannyDeclarations
2540
PyObject *__pyx_t_1 = NULL;
2541
PyObject *__pyx_t_2 = NULL;
2542
PyObject *__pyx_t_3 = NULL;
2543
PyObject *__pyx_t_4 = NULL;
2544
PyObject *__pyx_t_5 = NULL;
2545
PyObject *__pyx_t_6 = NULL;
2546
PyObject *__pyx_t_7 = NULL;
2547
__Pyx_RefNannySetupContext("characteristic_polynomial", 0);
2548
2549
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":29
2550
*
2551
* def characteristic_polynomial(self, var='x'):
2552
* from sage.rings.all import ZZ # <<<<<<<<<<<<<<
2553
* p = int(self.p)
2554
* return ZZ[var]([p*p, self.a0*p, self.a1, self.a0, 1])
2555
*/
2556
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 29, __pyx_L1_error)
2557
__Pyx_GOTREF(__pyx_t_1);
2558
__Pyx_INCREF(__pyx_n_s_ZZ);
2559
__Pyx_GIVEREF(__pyx_n_s_ZZ);
2560
PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_ZZ);
2561
__pyx_t_2 = __Pyx_Import(__pyx_n_s_sage_rings_all, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 29, __pyx_L1_error)
2562
__Pyx_GOTREF(__pyx_t_2);
2563
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2564
__pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ZZ); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 29, __pyx_L1_error)
2565
__Pyx_GOTREF(__pyx_t_1);
2566
__Pyx_INCREF(__pyx_t_1);
2567
__pyx_v_ZZ = __pyx_t_1;
2568
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2569
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2570
2571
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":30
2572
* def characteristic_polynomial(self, var='x'):
2573
* from sage.rings.all import ZZ
2574
* p = int(self.p) # <<<<<<<<<<<<<<
2575
* return ZZ[var]([p*p, self.a0*p, self.a1, self.a0, 1])
2576
*
2577
*/
2578
__pyx_t_2 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->p); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 30, __pyx_L1_error)
2579
__Pyx_GOTREF(__pyx_t_2);
2580
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 30, __pyx_L1_error)
2581
__Pyx_GOTREF(__pyx_t_1);
2582
__Pyx_GIVEREF(__pyx_t_2);
2583
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
2584
__pyx_t_2 = 0;
2585
__pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyInt_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 30, __pyx_L1_error)
2586
__Pyx_GOTREF(__pyx_t_2);
2587
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2588
__pyx_v_p = __pyx_t_2;
2589
__pyx_t_2 = 0;
2590
2591
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":31
2592
* from sage.rings.all import ZZ
2593
* p = int(self.p)
2594
* return ZZ[var]([p*p, self.a0*p, self.a1, self.a0, 1]) # <<<<<<<<<<<<<<
2595
*
2596
* charpoly = characteristic_polynomial
2597
*/
2598
__Pyx_XDECREF(__pyx_r);
2599
__pyx_t_1 = PyObject_GetItem(__pyx_v_ZZ, __pyx_v_var); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 31, __pyx_L1_error)
2600
__Pyx_GOTREF(__pyx_t_1);
2601
__pyx_t_3 = PyNumber_Multiply(__pyx_v_p, __pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 31, __pyx_L1_error)
2602
__Pyx_GOTREF(__pyx_t_3);
2603
__pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_self->a0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 31, __pyx_L1_error)
2604
__Pyx_GOTREF(__pyx_t_4);
2605
__pyx_t_5 = PyNumber_Multiply(__pyx_t_4, __pyx_v_p); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 31, __pyx_L1_error)
2606
__Pyx_GOTREF(__pyx_t_5);
2607
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2608
__pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_self->a1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 31, __pyx_L1_error)
2609
__Pyx_GOTREF(__pyx_t_4);
2610
__pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_self->a0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 31, __pyx_L1_error)
2611
__Pyx_GOTREF(__pyx_t_6);
2612
__pyx_t_7 = PyList_New(5); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 31, __pyx_L1_error)
2613
__Pyx_GOTREF(__pyx_t_7);
2614
__Pyx_GIVEREF(__pyx_t_3);
2615
PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
2616
__Pyx_GIVEREF(__pyx_t_5);
2617
PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
2618
__Pyx_GIVEREF(__pyx_t_4);
2619
PyList_SET_ITEM(__pyx_t_7, 2, __pyx_t_4);
2620
__Pyx_GIVEREF(__pyx_t_6);
2621
PyList_SET_ITEM(__pyx_t_7, 3, __pyx_t_6);
2622
__Pyx_INCREF(__pyx_int_1);
2623
__Pyx_GIVEREF(__pyx_int_1);
2624
PyList_SET_ITEM(__pyx_t_7, 4, __pyx_int_1);
2625
__pyx_t_3 = 0;
2626
__pyx_t_5 = 0;
2627
__pyx_t_4 = 0;
2628
__pyx_t_6 = 0;
2629
__pyx_t_6 = NULL;
2630
if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
2631
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
2632
if (likely(__pyx_t_6)) {
2633
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
2634
__Pyx_INCREF(__pyx_t_6);
2635
__Pyx_INCREF(function);
2636
__Pyx_DECREF_SET(__pyx_t_1, function);
2637
}
2638
}
2639
if (!__pyx_t_6) {
2640
__pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 31, __pyx_L1_error)
2641
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2642
__Pyx_GOTREF(__pyx_t_2);
2643
} else {
2644
#if CYTHON_FAST_PYCALL
2645
if (PyFunction_Check(__pyx_t_1)) {
2646
PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_7};
2647
__pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 31, __pyx_L1_error)
2648
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
2649
__Pyx_GOTREF(__pyx_t_2);
2650
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2651
} else
2652
#endif
2653
#if CYTHON_FAST_PYCCALL
2654
if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
2655
PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_7};
2656
__pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 31, __pyx_L1_error)
2657
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
2658
__Pyx_GOTREF(__pyx_t_2);
2659
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2660
} else
2661
#endif
2662
{
2663
__pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 31, __pyx_L1_error)
2664
__Pyx_GOTREF(__pyx_t_4);
2665
__Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
2666
__Pyx_GIVEREF(__pyx_t_7);
2667
PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_7);
2668
__pyx_t_7 = 0;
2669
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 31, __pyx_L1_error)
2670
__Pyx_GOTREF(__pyx_t_2);
2671
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2672
}
2673
}
2674
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2675
__pyx_r = __pyx_t_2;
2676
__pyx_t_2 = 0;
2677
goto __pyx_L0;
2678
2679
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":28
2680
* return -self.a0
2681
*
2682
* def characteristic_polynomial(self, var='x'): # <<<<<<<<<<<<<<
2683
* from sage.rings.all import ZZ
2684
* p = int(self.p)
2685
*/
2686
2687
/* function exit code */
2688
__pyx_L1_error:;
2689
__Pyx_XDECREF(__pyx_t_1);
2690
__Pyx_XDECREF(__pyx_t_2);
2691
__Pyx_XDECREF(__pyx_t_3);
2692
__Pyx_XDECREF(__pyx_t_4);
2693
__Pyx_XDECREF(__pyx_t_5);
2694
__Pyx_XDECREF(__pyx_t_6);
2695
__Pyx_XDECREF(__pyx_t_7);
2696
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.FrobPoly.characteristic_polynomial", __pyx_clineno, __pyx_lineno, __pyx_filename);
2697
__pyx_r = NULL;
2698
__pyx_L0:;
2699
__Pyx_XDECREF(__pyx_v_ZZ);
2700
__Pyx_XDECREF(__pyx_v_p);
2701
__Pyx_XGIVEREF(__pyx_r);
2702
__Pyx_RefNannyFinishContext();
2703
return __pyx_r;
2704
}
2705
2706
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":36
2707
*
2708
*
2709
* cpdef FrobPoly_new(long a0, long a1, unsigned long p): # <<<<<<<<<<<<<<
2710
* cdef FrobPoly L = PY_NEW(FrobPoly)
2711
* L.a0 = a0; L.a1 = a1; L.p = p
2712
*/
2713
2714
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_1FrobPoly_new(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2715
static PyObject *__pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly_new(long __pyx_v_a0, long __pyx_v_a1, unsigned long __pyx_v_p, CYTHON_UNUSED int __pyx_skip_dispatch) {
2716
struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *__pyx_v_L = 0;
2717
PyObject *__pyx_r = NULL;
2718
__Pyx_RefNannyDeclarations
2719
PyObject *__pyx_t_1 = NULL;
2720
__Pyx_RefNannySetupContext("FrobPoly_new", 0);
2721
2722
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":37
2723
*
2724
* cpdef FrobPoly_new(long a0, long a1, unsigned long p):
2725
* cdef FrobPoly L = PY_NEW(FrobPoly) # <<<<<<<<<<<<<<
2726
* L.a0 = a0; L.a1 = a1; L.p = p
2727
* return L
2728
*/
2729
__pyx_t_1 = __pyx_f_4sage_3ext_7stdsage_PY_NEW(__pyx_ptype_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 37, __pyx_L1_error)
2730
__Pyx_GOTREF(__pyx_t_1);
2731
if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly))))) __PYX_ERR(1, 37, __pyx_L1_error)
2732
__pyx_v_L = ((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly *)__pyx_t_1);
2733
__pyx_t_1 = 0;
2734
2735
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":38
2736
* cpdef FrobPoly_new(long a0, long a1, unsigned long p):
2737
* cdef FrobPoly L = PY_NEW(FrobPoly)
2738
* L.a0 = a0; L.a1 = a1; L.p = p # <<<<<<<<<<<<<<
2739
* return L
2740
*
2741
*/
2742
__pyx_v_L->a0 = __pyx_v_a0;
2743
__pyx_v_L->a1 = __pyx_v_a1;
2744
__pyx_v_L->p = __pyx_v_p;
2745
2746
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":39
2747
* cdef FrobPoly L = PY_NEW(FrobPoly)
2748
* L.a0 = a0; L.a1 = a1; L.p = p
2749
* return L # <<<<<<<<<<<<<<
2750
*
2751
* cdef int callback_Lpolys(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg):
2752
*/
2753
__Pyx_XDECREF(__pyx_r);
2754
__Pyx_INCREF(((PyObject *)__pyx_v_L));
2755
__pyx_r = ((PyObject *)__pyx_v_L);
2756
goto __pyx_L0;
2757
2758
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":36
2759
*
2760
*
2761
* cpdef FrobPoly_new(long a0, long a1, unsigned long p): # <<<<<<<<<<<<<<
2762
* cdef FrobPoly L = PY_NEW(FrobPoly)
2763
* L.a0 = a0; L.a1 = a1; L.p = p
2764
*/
2765
2766
/* function exit code */
2767
__pyx_L1_error:;
2768
__Pyx_XDECREF(__pyx_t_1);
2769
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.FrobPoly_new", __pyx_clineno, __pyx_lineno, __pyx_filename);
2770
__pyx_r = 0;
2771
__pyx_L0:;
2772
__Pyx_XDECREF((PyObject *)__pyx_v_L);
2773
__Pyx_XGIVEREF(__pyx_r);
2774
__Pyx_RefNannyFinishContext();
2775
return __pyx_r;
2776
}
2777
2778
/* Python wrapper */
2779
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_1FrobPoly_new(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2780
static char __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly_new[] = "File: wrapper2.pyx (starting at line 36)";
2781
static PyObject *__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_1FrobPoly_new(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2782
long __pyx_v_a0;
2783
long __pyx_v_a1;
2784
unsigned long __pyx_v_p;
2785
PyObject *__pyx_r = 0;
2786
__Pyx_RefNannyDeclarations
2787
__Pyx_RefNannySetupContext("FrobPoly_new (wrapper)", 0);
2788
{
2789
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a0,&__pyx_n_s_a1,&__pyx_n_s_p,0};
2790
PyObject* values[3] = {0,0,0};
2791
if (unlikely(__pyx_kwds)) {
2792
Py_ssize_t kw_args;
2793
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2794
switch (pos_args) {
2795
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2796
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2797
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2798
case 0: break;
2799
default: goto __pyx_L5_argtuple_error;
2800
}
2801
kw_args = PyDict_Size(__pyx_kwds);
2802
switch (pos_args) {
2803
case 0:
2804
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a0)) != 0)) kw_args--;
2805
else goto __pyx_L5_argtuple_error;
2806
case 1:
2807
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a1)) != 0)) kw_args--;
2808
else {
2809
__Pyx_RaiseArgtupleInvalid("FrobPoly_new", 1, 3, 3, 1); __PYX_ERR(1, 36, __pyx_L3_error)
2810
}
2811
case 2:
2812
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
2813
else {
2814
__Pyx_RaiseArgtupleInvalid("FrobPoly_new", 1, 3, 3, 2); __PYX_ERR(1, 36, __pyx_L3_error)
2815
}
2816
}
2817
if (unlikely(kw_args > 0)) {
2818
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "FrobPoly_new") < 0)) __PYX_ERR(1, 36, __pyx_L3_error)
2819
}
2820
} else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2821
goto __pyx_L5_argtuple_error;
2822
} else {
2823
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2824
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2825
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2826
}
2827
__pyx_v_a0 = __Pyx_PyInt_As_long(values[0]); if (unlikely((__pyx_v_a0 == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 36, __pyx_L3_error)
2828
__pyx_v_a1 = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v_a1 == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 36, __pyx_L3_error)
2829
__pyx_v_p = __Pyx_PyInt_As_unsigned_long(values[2]); if (unlikely((__pyx_v_p == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(1, 36, __pyx_L3_error)
2830
}
2831
goto __pyx_L4_argument_unpacking_done;
2832
__pyx_L5_argtuple_error:;
2833
__Pyx_RaiseArgtupleInvalid("FrobPoly_new", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 36, __pyx_L3_error)
2834
__pyx_L3_error:;
2835
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.FrobPoly_new", __pyx_clineno, __pyx_lineno, __pyx_filename);
2836
__Pyx_RefNannyFinishContext();
2837
return NULL;
2838
__pyx_L4_argument_unpacking_done:;
2839
__pyx_r = __pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly_new(__pyx_self, __pyx_v_a0, __pyx_v_a1, __pyx_v_p);
2840
2841
/* function exit code */
2842
__Pyx_RefNannyFinishContext();
2843
return __pyx_r;
2844
}
2845
2846
static PyObject *__pyx_pf_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly_new(CYTHON_UNUSED PyObject *__pyx_self, long __pyx_v_a0, long __pyx_v_a1, unsigned long __pyx_v_p) {
2847
PyObject *__pyx_r = NULL;
2848
__Pyx_RefNannyDeclarations
2849
PyObject *__pyx_t_1 = NULL;
2850
__Pyx_RefNannySetupContext("FrobPoly_new", 0);
2851
__Pyx_XDECREF(__pyx_r);
2852
__pyx_t_1 = __pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly_new(__pyx_v_a0, __pyx_v_a1, __pyx_v_p, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 36, __pyx_L1_error)
2853
__Pyx_GOTREF(__pyx_t_1);
2854
__pyx_r = __pyx_t_1;
2855
__pyx_t_1 = 0;
2856
goto __pyx_L0;
2857
2858
/* function exit code */
2859
__pyx_L1_error:;
2860
__Pyx_XDECREF(__pyx_t_1);
2861
__Pyx_AddTraceback("code.alex.psage.psage.libs.smalljac.wrapper2.FrobPoly_new", __pyx_clineno, __pyx_lineno, __pyx_filename);
2862
__pyx_r = NULL;
2863
__pyx_L0:;
2864
__Pyx_XGIVEREF(__pyx_r);
2865
__Pyx_RefNannyFinishContext();
2866
return __pyx_r;
2867
}
2868
2869
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":41
2870
* return L
2871
*
2872
* cdef int callback_Lpolys(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg): # <<<<<<<<<<<<<<
2873
* cdef int i
2874
* if good:
2875
*/
2876
2877
static int __pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_callback_Lpolys(CYTHON_UNUSED smalljac_Qcurve_t __pyx_v_c, unsigned long __pyx_v_p, int __pyx_v_good, long *__pyx_v_a, CYTHON_UNUSED int __pyx_v_n, void *__pyx_v_arg) {
2878
int __pyx_r;
2879
__Pyx_RefNannyDeclarations
2880
int __pyx_t_1;
2881
PyObject *__pyx_t_2 = NULL;
2882
PyObject *__pyx_t_3 = NULL;
2883
PyObject *__pyx_t_4 = NULL;
2884
__Pyx_RefNannySetupContext("callback_Lpolys", 0);
2885
2886
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":43
2887
* cdef int callback_Lpolys(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg):
2888
* cdef int i
2889
* if good: # <<<<<<<<<<<<<<
2890
* (<SmallJac>arg).tmp[int(p)] = FrobPoly_new(a[0], a[1], p)
2891
* else:
2892
*/
2893
__pyx_t_1 = (__pyx_v_good != 0);
2894
if (__pyx_t_1) {
2895
2896
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":44
2897
* cdef int i
2898
* if good:
2899
* (<SmallJac>arg).tmp[int(p)] = FrobPoly_new(a[0], a[1], p) # <<<<<<<<<<<<<<
2900
* else:
2901
* (<SmallJac>arg).tmp[int(p)] = None
2902
*/
2903
__pyx_t_2 = __pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly_new((__pyx_v_a[0]), (__pyx_v_a[1]), __pyx_v_p, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 44, __pyx_L1_error)
2904
__Pyx_GOTREF(__pyx_t_2);
2905
__pyx_t_3 = __Pyx_PyInt_From_unsigned_long(__pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 44, __pyx_L1_error)
2906
__Pyx_GOTREF(__pyx_t_3);
2907
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 44, __pyx_L1_error)
2908
__Pyx_GOTREF(__pyx_t_4);
2909
__Pyx_GIVEREF(__pyx_t_3);
2910
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
2911
__pyx_t_3 = 0;
2912
__pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyInt_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 44, __pyx_L1_error)
2913
__Pyx_GOTREF(__pyx_t_3);
2914
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2915
if (unlikely(PyObject_SetItem(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_arg)->tmp, __pyx_t_3, __pyx_t_2) < 0)) __PYX_ERR(1, 44, __pyx_L1_error)
2916
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2917
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2918
2919
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":43
2920
* cdef int callback_Lpolys(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg):
2921
* cdef int i
2922
* if good: # <<<<<<<<<<<<<<
2923
* (<SmallJac>arg).tmp[int(p)] = FrobPoly_new(a[0], a[1], p)
2924
* else:
2925
*/
2926
goto __pyx_L3;
2927
}
2928
2929
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":46
2930
* (<SmallJac>arg).tmp[int(p)] = FrobPoly_new(a[0], a[1], p)
2931
* else:
2932
* (<SmallJac>arg).tmp[int(p)] = None # <<<<<<<<<<<<<<
2933
* return 1
2934
*
2935
*/
2936
/*else*/ {
2937
__pyx_t_2 = __Pyx_PyInt_From_unsigned_long(__pyx_v_p); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 46, __pyx_L1_error)
2938
__Pyx_GOTREF(__pyx_t_2);
2939
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 46, __pyx_L1_error)
2940
__Pyx_GOTREF(__pyx_t_3);
2941
__Pyx_GIVEREF(__pyx_t_2);
2942
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
2943
__pyx_t_2 = 0;
2944
__pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyInt_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 46, __pyx_L1_error)
2945
__Pyx_GOTREF(__pyx_t_2);
2946
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2947
if (unlikely(PyObject_SetItem(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_arg)->tmp, __pyx_t_2, Py_None) < 0)) __PYX_ERR(1, 46, __pyx_L1_error)
2948
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2949
}
2950
__pyx_L3:;
2951
2952
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":47
2953
* else:
2954
* (<SmallJac>arg).tmp[int(p)] = None
2955
* return 1 # <<<<<<<<<<<<<<
2956
*
2957
* cdef int callback_Lpolys_single(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg):
2958
*/
2959
__pyx_r = 1;
2960
goto __pyx_L0;
2961
2962
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":41
2963
* return L
2964
*
2965
* cdef int callback_Lpolys(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg): # <<<<<<<<<<<<<<
2966
* cdef int i
2967
* if good:
2968
*/
2969
2970
/* function exit code */
2971
__pyx_L1_error:;
2972
__Pyx_XDECREF(__pyx_t_2);
2973
__Pyx_XDECREF(__pyx_t_3);
2974
__Pyx_XDECREF(__pyx_t_4);
2975
__Pyx_WriteUnraisable("code.alex.psage.psage.libs.smalljac.wrapper2.callback_Lpolys", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
2976
__pyx_r = 0;
2977
__pyx_L0:;
2978
__Pyx_RefNannyFinishContext();
2979
return __pyx_r;
2980
}
2981
2982
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":49
2983
* return 1
2984
*
2985
* cdef int callback_Lpolys_single(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg): # <<<<<<<<<<<<<<
2986
* cdef int i
2987
* if good:
2988
*/
2989
2990
static int __pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_callback_Lpolys_single(CYTHON_UNUSED smalljac_Qcurve_t __pyx_v_c, unsigned long __pyx_v_p, int __pyx_v_good, long *__pyx_v_a, CYTHON_UNUSED int __pyx_v_n, void *__pyx_v_arg) {
2991
int __pyx_r;
2992
__Pyx_RefNannyDeclarations
2993
int __pyx_t_1;
2994
PyObject *__pyx_t_2 = NULL;
2995
__Pyx_RefNannySetupContext("callback_Lpolys_single", 0);
2996
2997
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":51
2998
* cdef int callback_Lpolys_single(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg):
2999
* cdef int i
3000
* if good: # <<<<<<<<<<<<<<
3001
* (<SmallJac>arg).tmp = FrobPoly_new(a[0], a[1], p)
3002
* else:
3003
*/
3004
__pyx_t_1 = (__pyx_v_good != 0);
3005
if (__pyx_t_1) {
3006
3007
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":52
3008
* cdef int i
3009
* if good:
3010
* (<SmallJac>arg).tmp = FrobPoly_new(a[0], a[1], p) # <<<<<<<<<<<<<<
3011
* else:
3012
* (<SmallJac>arg).tmp = None
3013
*/
3014
__pyx_t_2 = __pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly_new((__pyx_v_a[0]), (__pyx_v_a[1]), __pyx_v_p, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 52, __pyx_L1_error)
3015
__Pyx_GOTREF(__pyx_t_2);
3016
__Pyx_GIVEREF(__pyx_t_2);
3017
__Pyx_GOTREF(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_arg)->tmp);
3018
__Pyx_DECREF(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_arg)->tmp);
3019
((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_arg)->tmp = __pyx_t_2;
3020
__pyx_t_2 = 0;
3021
3022
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":51
3023
* cdef int callback_Lpolys_single(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg):
3024
* cdef int i
3025
* if good: # <<<<<<<<<<<<<<
3026
* (<SmallJac>arg).tmp = FrobPoly_new(a[0], a[1], p)
3027
* else:
3028
*/
3029
goto __pyx_L3;
3030
}
3031
3032
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":54
3033
* (<SmallJac>arg).tmp = FrobPoly_new(a[0], a[1], p)
3034
* else:
3035
* (<SmallJac>arg).tmp = None # <<<<<<<<<<<<<<
3036
* return 1
3037
*
3038
*/
3039
/*else*/ {
3040
__Pyx_INCREF(Py_None);
3041
__Pyx_GIVEREF(Py_None);
3042
__Pyx_GOTREF(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_arg)->tmp);
3043
__Pyx_DECREF(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_arg)->tmp);
3044
((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_arg)->tmp = Py_None;
3045
}
3046
__pyx_L3:;
3047
3048
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":55
3049
* else:
3050
* (<SmallJac>arg).tmp = None
3051
* return 1 # <<<<<<<<<<<<<<
3052
*
3053
* cdef int callback_ap_dict(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg):
3054
*/
3055
__pyx_r = 1;
3056
goto __pyx_L0;
3057
3058
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":49
3059
* return 1
3060
*
3061
* cdef int callback_Lpolys_single(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg): # <<<<<<<<<<<<<<
3062
* cdef int i
3063
* if good:
3064
*/
3065
3066
/* function exit code */
3067
__pyx_L1_error:;
3068
__Pyx_XDECREF(__pyx_t_2);
3069
__Pyx_WriteUnraisable("code.alex.psage.psage.libs.smalljac.wrapper2.callback_Lpolys_single", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
3070
__pyx_r = 0;
3071
__pyx_L0:;
3072
__Pyx_RefNannyFinishContext();
3073
return __pyx_r;
3074
}
3075
3076
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":57
3077
* return 1
3078
*
3079
* cdef int callback_ap_dict(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg): # <<<<<<<<<<<<<<
3080
* if good:
3081
* (<SmallJac>arg).tmp[int(p)] = -a[0]
3082
*/
3083
3084
static int __pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_callback_ap_dict(CYTHON_UNUSED smalljac_Qcurve_t __pyx_v_c, unsigned long __pyx_v_p, int __pyx_v_good, long *__pyx_v_a, CYTHON_UNUSED int __pyx_v_n, void *__pyx_v_arg) {
3085
int __pyx_r;
3086
__Pyx_RefNannyDeclarations
3087
int __pyx_t_1;
3088
PyObject *__pyx_t_2 = NULL;
3089
PyObject *__pyx_t_3 = NULL;
3090
PyObject *__pyx_t_4 = NULL;
3091
__Pyx_RefNannySetupContext("callback_ap_dict", 0);
3092
3093
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":58
3094
*
3095
* cdef int callback_ap_dict(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg):
3096
* if good: # <<<<<<<<<<<<<<
3097
* (<SmallJac>arg).tmp[int(p)] = -a[0]
3098
* else:
3099
*/
3100
__pyx_t_1 = (__pyx_v_good != 0);
3101
if (__pyx_t_1) {
3102
3103
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":59
3104
* cdef int callback_ap_dict(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg):
3105
* if good:
3106
* (<SmallJac>arg).tmp[int(p)] = -a[0] # <<<<<<<<<<<<<<
3107
* else:
3108
* (<SmallJac>arg).tmp[int(p)] = None
3109
*/
3110
__pyx_t_2 = __Pyx_PyInt_From_long((-(__pyx_v_a[0]))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 59, __pyx_L1_error)
3111
__Pyx_GOTREF(__pyx_t_2);
3112
__pyx_t_3 = __Pyx_PyInt_From_unsigned_long(__pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 59, __pyx_L1_error)
3113
__Pyx_GOTREF(__pyx_t_3);
3114
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 59, __pyx_L1_error)
3115
__Pyx_GOTREF(__pyx_t_4);
3116
__Pyx_GIVEREF(__pyx_t_3);
3117
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
3118
__pyx_t_3 = 0;
3119
__pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyInt_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 59, __pyx_L1_error)
3120
__Pyx_GOTREF(__pyx_t_3);
3121
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3122
if (unlikely(PyObject_SetItem(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_arg)->tmp, __pyx_t_3, __pyx_t_2) < 0)) __PYX_ERR(1, 59, __pyx_L1_error)
3123
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3124
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3125
3126
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":58
3127
*
3128
* cdef int callback_ap_dict(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg):
3129
* if good: # <<<<<<<<<<<<<<
3130
* (<SmallJac>arg).tmp[int(p)] = -a[0]
3131
* else:
3132
*/
3133
goto __pyx_L3;
3134
}
3135
3136
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":61
3137
* (<SmallJac>arg).tmp[int(p)] = -a[0]
3138
* else:
3139
* (<SmallJac>arg).tmp[int(p)] = None # <<<<<<<<<<<<<<
3140
* return 1
3141
*
3142
*/
3143
/*else*/ {
3144
__pyx_t_2 = __Pyx_PyInt_From_unsigned_long(__pyx_v_p); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 61, __pyx_L1_error)
3145
__Pyx_GOTREF(__pyx_t_2);
3146
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 61, __pyx_L1_error)
3147
__Pyx_GOTREF(__pyx_t_3);
3148
__Pyx_GIVEREF(__pyx_t_2);
3149
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
3150
__pyx_t_2 = 0;
3151
__pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyInt_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 61, __pyx_L1_error)
3152
__Pyx_GOTREF(__pyx_t_2);
3153
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3154
if (unlikely(PyObject_SetItem(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_arg)->tmp, __pyx_t_2, Py_None) < 0)) __PYX_ERR(1, 61, __pyx_L1_error)
3155
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3156
}
3157
__pyx_L3:;
3158
3159
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":62
3160
* else:
3161
* (<SmallJac>arg).tmp[int(p)] = None
3162
* return 1 # <<<<<<<<<<<<<<
3163
*
3164
* cdef int callback_ap_single(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg):
3165
*/
3166
__pyx_r = 1;
3167
goto __pyx_L0;
3168
3169
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":57
3170
* return 1
3171
*
3172
* cdef int callback_ap_dict(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg): # <<<<<<<<<<<<<<
3173
* if good:
3174
* (<SmallJac>arg).tmp[int(p)] = -a[0]
3175
*/
3176
3177
/* function exit code */
3178
__pyx_L1_error:;
3179
__Pyx_XDECREF(__pyx_t_2);
3180
__Pyx_XDECREF(__pyx_t_3);
3181
__Pyx_XDECREF(__pyx_t_4);
3182
__Pyx_WriteUnraisable("code.alex.psage.psage.libs.smalljac.wrapper2.callback_ap_dict", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
3183
__pyx_r = 0;
3184
__pyx_L0:;
3185
__Pyx_RefNannyFinishContext();
3186
return __pyx_r;
3187
}
3188
3189
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":64
3190
* return 1
3191
*
3192
* cdef int callback_ap_single(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg): # <<<<<<<<<<<<<<
3193
* if good:
3194
* (<SmallJac>arg).tmp = -a[0]
3195
*/
3196
3197
static int __pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_callback_ap_single(CYTHON_UNUSED smalljac_Qcurve_t __pyx_v_c, CYTHON_UNUSED unsigned long __pyx_v_p, int __pyx_v_good, long *__pyx_v_a, CYTHON_UNUSED int __pyx_v_n, void *__pyx_v_arg) {
3198
int __pyx_r;
3199
__Pyx_RefNannyDeclarations
3200
int __pyx_t_1;
3201
PyObject *__pyx_t_2 = NULL;
3202
__Pyx_RefNannySetupContext("callback_ap_single", 0);
3203
3204
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":65
3205
*
3206
* cdef int callback_ap_single(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg):
3207
* if good: # <<<<<<<<<<<<<<
3208
* (<SmallJac>arg).tmp = -a[0]
3209
* else:
3210
*/
3211
__pyx_t_1 = (__pyx_v_good != 0);
3212
if (__pyx_t_1) {
3213
3214
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":66
3215
* cdef int callback_ap_single(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg):
3216
* if good:
3217
* (<SmallJac>arg).tmp = -a[0] # <<<<<<<<<<<<<<
3218
* else:
3219
* (<SmallJac>arg).tmp = None
3220
*/
3221
__pyx_t_2 = __Pyx_PyInt_From_long((-(__pyx_v_a[0]))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 66, __pyx_L1_error)
3222
__Pyx_GOTREF(__pyx_t_2);
3223
__Pyx_GIVEREF(__pyx_t_2);
3224
__Pyx_GOTREF(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_arg)->tmp);
3225
__Pyx_DECREF(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_arg)->tmp);
3226
((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_arg)->tmp = __pyx_t_2;
3227
__pyx_t_2 = 0;
3228
3229
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":65
3230
*
3231
* cdef int callback_ap_single(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg):
3232
* if good: # <<<<<<<<<<<<<<
3233
* (<SmallJac>arg).tmp = -a[0]
3234
* else:
3235
*/
3236
goto __pyx_L3;
3237
}
3238
3239
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":68
3240
* (<SmallJac>arg).tmp = -a[0]
3241
* else:
3242
* (<SmallJac>arg).tmp = None # <<<<<<<<<<<<<<
3243
* return 1
3244
*/
3245
/*else*/ {
3246
__Pyx_INCREF(Py_None);
3247
__Pyx_GIVEREF(Py_None);
3248
__Pyx_GOTREF(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_arg)->tmp);
3249
__Pyx_DECREF(((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_arg)->tmp);
3250
((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)__pyx_v_arg)->tmp = Py_None;
3251
}
3252
__pyx_L3:;
3253
3254
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":69
3255
* else:
3256
* (<SmallJac>arg).tmp = None
3257
* return 1 # <<<<<<<<<<<<<<
3258
*/
3259
__pyx_r = 1;
3260
goto __pyx_L0;
3261
3262
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":64
3263
* return 1
3264
*
3265
* cdef int callback_ap_single(smalljac_Qcurve_t c, unsigned long p, int good, long a[], int n, void *arg): # <<<<<<<<<<<<<<
3266
* if good:
3267
* (<SmallJac>arg).tmp = -a[0]
3268
*/
3269
3270
/* function exit code */
3271
__pyx_L1_error:;
3272
__Pyx_XDECREF(__pyx_t_2);
3273
__Pyx_WriteUnraisable("code.alex.psage.psage.libs.smalljac.wrapper2.callback_ap_single", __pyx_clineno, __pyx_lineno, __pyx_filename, 0, 0);
3274
__pyx_r = 0;
3275
__pyx_L0:;
3276
__Pyx_RefNannyFinishContext();
3277
return __pyx_r;
3278
}
3279
3280
/* "cysignals/memory.pxd":40
3281
*
3282
*
3283
* cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil: # <<<<<<<<<<<<<<
3284
* sig_block()
3285
* cdef void* ret = malloc(n)
3286
*/
3287
3288
static CYTHON_INLINE void *sig_malloc(size_t __pyx_v_n) {
3289
void *__pyx_v_ret;
3290
void *__pyx_r;
3291
3292
/* "cysignals/memory.pxd":41
3293
*
3294
* cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil:
3295
* sig_block() # <<<<<<<<<<<<<<
3296
* cdef void* ret = malloc(n)
3297
* sig_unblock()
3298
*/
3299
sig_block();
3300
3301
/* "cysignals/memory.pxd":42
3302
* cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil:
3303
* sig_block()
3304
* cdef void* ret = malloc(n) # <<<<<<<<<<<<<<
3305
* sig_unblock()
3306
* return ret
3307
*/
3308
__pyx_v_ret = malloc(__pyx_v_n);
3309
3310
/* "cysignals/memory.pxd":43
3311
* sig_block()
3312
* cdef void* ret = malloc(n)
3313
* sig_unblock() # <<<<<<<<<<<<<<
3314
* return ret
3315
*
3316
*/
3317
sig_unblock();
3318
3319
/* "cysignals/memory.pxd":44
3320
* cdef void* ret = malloc(n)
3321
* sig_unblock()
3322
* return ret # <<<<<<<<<<<<<<
3323
*
3324
*
3325
*/
3326
__pyx_r = __pyx_v_ret;
3327
goto __pyx_L0;
3328
3329
/* "cysignals/memory.pxd":40
3330
*
3331
*
3332
* cdef inline void* sig_malloc "sig_malloc"(size_t n) nogil: # <<<<<<<<<<<<<<
3333
* sig_block()
3334
* cdef void* ret = malloc(n)
3335
*/
3336
3337
/* function exit code */
3338
__pyx_L0:;
3339
return __pyx_r;
3340
}
3341
3342
/* "cysignals/memory.pxd":47
3343
*
3344
*
3345
* cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil: # <<<<<<<<<<<<<<
3346
* sig_block()
3347
* cdef void* ret = realloc(ptr, size)
3348
*/
3349
3350
static CYTHON_INLINE void *sig_realloc(void *__pyx_v_ptr, size_t __pyx_v_size) {
3351
void *__pyx_v_ret;
3352
void *__pyx_r;
3353
3354
/* "cysignals/memory.pxd":48
3355
*
3356
* cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil:
3357
* sig_block() # <<<<<<<<<<<<<<
3358
* cdef void* ret = realloc(ptr, size)
3359
* sig_unblock()
3360
*/
3361
sig_block();
3362
3363
/* "cysignals/memory.pxd":49
3364
* cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil:
3365
* sig_block()
3366
* cdef void* ret = realloc(ptr, size) # <<<<<<<<<<<<<<
3367
* sig_unblock()
3368
* return ret
3369
*/
3370
__pyx_v_ret = realloc(__pyx_v_ptr, __pyx_v_size);
3371
3372
/* "cysignals/memory.pxd":50
3373
* sig_block()
3374
* cdef void* ret = realloc(ptr, size)
3375
* sig_unblock() # <<<<<<<<<<<<<<
3376
* return ret
3377
*
3378
*/
3379
sig_unblock();
3380
3381
/* "cysignals/memory.pxd":51
3382
* cdef void* ret = realloc(ptr, size)
3383
* sig_unblock()
3384
* return ret # <<<<<<<<<<<<<<
3385
*
3386
*
3387
*/
3388
__pyx_r = __pyx_v_ret;
3389
goto __pyx_L0;
3390
3391
/* "cysignals/memory.pxd":47
3392
*
3393
*
3394
* cdef inline void* sig_realloc "sig_realloc"(void* ptr, size_t size) nogil: # <<<<<<<<<<<<<<
3395
* sig_block()
3396
* cdef void* ret = realloc(ptr, size)
3397
*/
3398
3399
/* function exit code */
3400
__pyx_L0:;
3401
return __pyx_r;
3402
}
3403
3404
/* "cysignals/memory.pxd":54
3405
*
3406
*
3407
* cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil: # <<<<<<<<<<<<<<
3408
* sig_block()
3409
* cdef void* ret = calloc(nmemb, size)
3410
*/
3411
3412
static CYTHON_INLINE void *sig_calloc(size_t __pyx_v_nmemb, size_t __pyx_v_size) {
3413
void *__pyx_v_ret;
3414
void *__pyx_r;
3415
3416
/* "cysignals/memory.pxd":55
3417
*
3418
* cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil:
3419
* sig_block() # <<<<<<<<<<<<<<
3420
* cdef void* ret = calloc(nmemb, size)
3421
* sig_unblock()
3422
*/
3423
sig_block();
3424
3425
/* "cysignals/memory.pxd":56
3426
* cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil:
3427
* sig_block()
3428
* cdef void* ret = calloc(nmemb, size) # <<<<<<<<<<<<<<
3429
* sig_unblock()
3430
* return ret
3431
*/
3432
__pyx_v_ret = calloc(__pyx_v_nmemb, __pyx_v_size);
3433
3434
/* "cysignals/memory.pxd":57
3435
* sig_block()
3436
* cdef void* ret = calloc(nmemb, size)
3437
* sig_unblock() # <<<<<<<<<<<<<<
3438
* return ret
3439
*
3440
*/
3441
sig_unblock();
3442
3443
/* "cysignals/memory.pxd":58
3444
* cdef void* ret = calloc(nmemb, size)
3445
* sig_unblock()
3446
* return ret # <<<<<<<<<<<<<<
3447
*
3448
*
3449
*/
3450
__pyx_r = __pyx_v_ret;
3451
goto __pyx_L0;
3452
3453
/* "cysignals/memory.pxd":54
3454
*
3455
*
3456
* cdef inline void* sig_calloc "sig_calloc"(size_t nmemb, size_t size) nogil: # <<<<<<<<<<<<<<
3457
* sig_block()
3458
* cdef void* ret = calloc(nmemb, size)
3459
*/
3460
3461
/* function exit code */
3462
__pyx_L0:;
3463
return __pyx_r;
3464
}
3465
3466
/* "cysignals/memory.pxd":61
3467
*
3468
*
3469
* cdef inline void sig_free "sig_free"(void* ptr) nogil: # <<<<<<<<<<<<<<
3470
* sig_block()
3471
* free(ptr)
3472
*/
3473
3474
static CYTHON_INLINE void sig_free(void *__pyx_v_ptr) {
3475
3476
/* "cysignals/memory.pxd":62
3477
*
3478
* cdef inline void sig_free "sig_free"(void* ptr) nogil:
3479
* sig_block() # <<<<<<<<<<<<<<
3480
* free(ptr)
3481
* sig_unblock()
3482
*/
3483
sig_block();
3484
3485
/* "cysignals/memory.pxd":63
3486
* cdef inline void sig_free "sig_free"(void* ptr) nogil:
3487
* sig_block()
3488
* free(ptr) # <<<<<<<<<<<<<<
3489
* sig_unblock()
3490
*
3491
*/
3492
free(__pyx_v_ptr);
3493
3494
/* "cysignals/memory.pxd":64
3495
* sig_block()
3496
* free(ptr)
3497
* sig_unblock() # <<<<<<<<<<<<<<
3498
*
3499
*
3500
*/
3501
sig_unblock();
3502
3503
/* "cysignals/memory.pxd":61
3504
*
3505
*
3506
* cdef inline void sig_free "sig_free"(void* ptr) nogil: # <<<<<<<<<<<<<<
3507
* sig_block()
3508
* free(ptr)
3509
*/
3510
3511
/* function exit code */
3512
}
3513
3514
/* "cysignals/memory.pxd":68
3515
*
3516
* @cython.cdivision(True)
3517
* cdef inline size_t mul_overflowcheck(size_t a, size_t b) nogil: # <<<<<<<<<<<<<<
3518
* """
3519
* Return a*b, checking for overflow. Assume that a > 0.
3520
*/
3521
3522
static CYTHON_INLINE size_t __pyx_f_9cysignals_6memory_mul_overflowcheck(size_t __pyx_v_a, size_t __pyx_v_b) {
3523
size_t __pyx_v_MUL_NO_OVERFLOW;
3524
size_t __pyx_r;
3525
int __pyx_t_1;
3526
int __pyx_t_2;
3527
3528
/* "cysignals/memory.pxd":75
3529
* """
3530
* # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur
3531
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t))) # <<<<<<<<<<<<<<
3532
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
3533
* if unlikely(b > (<size_t>-1) // a):
3534
*/
3535
__pyx_v_MUL_NO_OVERFLOW = (((size_t)1) << (4 * (sizeof(size_t))));
3536
3537
/* "cysignals/memory.pxd":76
3538
* # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur
3539
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
3540
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW: # <<<<<<<<<<<<<<
3541
* if unlikely(b > (<size_t>-1) // a):
3542
* return <size_t>(-1)
3543
*/
3544
__pyx_t_2 = ((__pyx_v_a >= __pyx_v_MUL_NO_OVERFLOW) != 0);
3545
if (!__pyx_t_2) {
3546
} else {
3547
__pyx_t_1 = __pyx_t_2;
3548
goto __pyx_L4_bool_binop_done;
3549
}
3550
__pyx_t_2 = ((__pyx_v_b >= __pyx_v_MUL_NO_OVERFLOW) != 0);
3551
__pyx_t_1 = __pyx_t_2;
3552
__pyx_L4_bool_binop_done:;
3553
if (__pyx_t_1) {
3554
3555
/* "cysignals/memory.pxd":77
3556
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
3557
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
3558
* if unlikely(b > (<size_t>-1) // a): # <<<<<<<<<<<<<<
3559
* return <size_t>(-1)
3560
* return a*b
3561
*/
3562
__pyx_t_1 = (unlikely((__pyx_v_b > (((size_t)-1L) / __pyx_v_a))) != 0);
3563
if (__pyx_t_1) {
3564
3565
/* "cysignals/memory.pxd":78
3566
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
3567
* if unlikely(b > (<size_t>-1) // a):
3568
* return <size_t>(-1) # <<<<<<<<<<<<<<
3569
* return a*b
3570
*
3571
*/
3572
__pyx_r = ((size_t)-1L);
3573
goto __pyx_L0;
3574
3575
/* "cysignals/memory.pxd":77
3576
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
3577
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW:
3578
* if unlikely(b > (<size_t>-1) // a): # <<<<<<<<<<<<<<
3579
* return <size_t>(-1)
3580
* return a*b
3581
*/
3582
}
3583
3584
/* "cysignals/memory.pxd":76
3585
* # If a and b both less than MUL_NO_OVERFLOW, no overflow can occur
3586
* cdef size_t MUL_NO_OVERFLOW = ((<size_t>1) << (4*sizeof(size_t)))
3587
* if a >= MUL_NO_OVERFLOW or b >= MUL_NO_OVERFLOW: # <<<<<<<<<<<<<<
3588
* if unlikely(b > (<size_t>-1) // a):
3589
* return <size_t>(-1)
3590
*/
3591
}
3592
3593
/* "cysignals/memory.pxd":79
3594
* if unlikely(b > (<size_t>-1) // a):
3595
* return <size_t>(-1)
3596
* return a*b # <<<<<<<<<<<<<<
3597
*
3598
*
3599
*/
3600
__pyx_r = (__pyx_v_a * __pyx_v_b);
3601
goto __pyx_L0;
3602
3603
/* "cysignals/memory.pxd":68
3604
*
3605
* @cython.cdivision(True)
3606
* cdef inline size_t mul_overflowcheck(size_t a, size_t b) nogil: # <<<<<<<<<<<<<<
3607
* """
3608
* Return a*b, checking for overflow. Assume that a > 0.
3609
*/
3610
3611
/* function exit code */
3612
__pyx_L0:;
3613
return __pyx_r;
3614
}
3615
3616
/* "cysignals/memory.pxd":82
3617
*
3618
*
3619
* cdef inline void* check_allocarray(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
3620
* """
3621
* Allocate memory for ``nmemb`` elements of size ``size``.
3622
*/
3623
3624
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_allocarray(size_t __pyx_v_nmemb, size_t __pyx_v_size) {
3625
size_t __pyx_v_n;
3626
void *__pyx_v_ret;
3627
void *__pyx_r;
3628
__Pyx_RefNannyDeclarations
3629
int __pyx_t_1;
3630
PyObject *__pyx_t_2 = NULL;
3631
PyObject *__pyx_t_3 = NULL;
3632
PyObject *__pyx_t_4 = NULL;
3633
__Pyx_RefNannySetupContext("check_allocarray", 0);
3634
3635
/* "cysignals/memory.pxd":86
3636
* Allocate memory for ``nmemb`` elements of size ``size``.
3637
* """
3638
* if nmemb == 0: # <<<<<<<<<<<<<<
3639
* return NULL
3640
* cdef size_t n = mul_overflowcheck(nmemb, size)
3641
*/
3642
__pyx_t_1 = ((__pyx_v_nmemb == 0) != 0);
3643
if (__pyx_t_1) {
3644
3645
/* "cysignals/memory.pxd":87
3646
* """
3647
* if nmemb == 0:
3648
* return NULL # <<<<<<<<<<<<<<
3649
* cdef size_t n = mul_overflowcheck(nmemb, size)
3650
* cdef void* ret = sig_malloc(n)
3651
*/
3652
__pyx_r = NULL;
3653
goto __pyx_L0;
3654
3655
/* "cysignals/memory.pxd":86
3656
* Allocate memory for ``nmemb`` elements of size ``size``.
3657
* """
3658
* if nmemb == 0: # <<<<<<<<<<<<<<
3659
* return NULL
3660
* cdef size_t n = mul_overflowcheck(nmemb, size)
3661
*/
3662
}
3663
3664
/* "cysignals/memory.pxd":88
3665
* if nmemb == 0:
3666
* return NULL
3667
* cdef size_t n = mul_overflowcheck(nmemb, size) # <<<<<<<<<<<<<<
3668
* cdef void* ret = sig_malloc(n)
3669
* if unlikely(ret == NULL):
3670
*/
3671
__pyx_v_n = __pyx_f_9cysignals_6memory_mul_overflowcheck(__pyx_v_nmemb, __pyx_v_size);
3672
3673
/* "cysignals/memory.pxd":89
3674
* return NULL
3675
* cdef size_t n = mul_overflowcheck(nmemb, size)
3676
* cdef void* ret = sig_malloc(n) # <<<<<<<<<<<<<<
3677
* if unlikely(ret == NULL):
3678
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
3679
*/
3680
__pyx_v_ret = sig_malloc(__pyx_v_n);
3681
3682
/* "cysignals/memory.pxd":90
3683
* cdef size_t n = mul_overflowcheck(nmemb, size)
3684
* cdef void* ret = sig_malloc(n)
3685
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
3686
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
3687
* return ret
3688
*/
3689
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
3690
if (__pyx_t_1) {
3691
3692
/* "cysignals/memory.pxd":91
3693
* cdef void* ret = sig_malloc(n)
3694
* if unlikely(ret == NULL):
3695
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) # <<<<<<<<<<<<<<
3696
* return ret
3697
*
3698
*/
3699
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 91, __pyx_L1_error)
3700
__Pyx_GOTREF(__pyx_t_2);
3701
__pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 91, __pyx_L1_error)
3702
__Pyx_GOTREF(__pyx_t_3);
3703
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 91, __pyx_L1_error)
3704
__Pyx_GOTREF(__pyx_t_4);
3705
__Pyx_GIVEREF(__pyx_t_2);
3706
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
3707
__Pyx_GIVEREF(__pyx_t_3);
3708
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
3709
__pyx_t_2 = 0;
3710
__pyx_t_3 = 0;
3711
__pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_s_bytes, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 91, __pyx_L1_error)
3712
__Pyx_GOTREF(__pyx_t_3);
3713
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3714
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 91, __pyx_L1_error)
3715
__Pyx_GOTREF(__pyx_t_4);
3716
__Pyx_GIVEREF(__pyx_t_3);
3717
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
3718
__pyx_t_3 = 0;
3719
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 91, __pyx_L1_error)
3720
__Pyx_GOTREF(__pyx_t_3);
3721
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3722
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
3723
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3724
__PYX_ERR(2, 91, __pyx_L1_error)
3725
3726
/* "cysignals/memory.pxd":90
3727
* cdef size_t n = mul_overflowcheck(nmemb, size)
3728
* cdef void* ret = sig_malloc(n)
3729
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
3730
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
3731
* return ret
3732
*/
3733
}
3734
3735
/* "cysignals/memory.pxd":92
3736
* if unlikely(ret == NULL):
3737
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
3738
* return ret # <<<<<<<<<<<<<<
3739
*
3740
*
3741
*/
3742
__pyx_r = __pyx_v_ret;
3743
goto __pyx_L0;
3744
3745
/* "cysignals/memory.pxd":82
3746
*
3747
*
3748
* cdef inline void* check_allocarray(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
3749
* """
3750
* Allocate memory for ``nmemb`` elements of size ``size``.
3751
*/
3752
3753
/* function exit code */
3754
__pyx_L1_error:;
3755
__Pyx_XDECREF(__pyx_t_2);
3756
__Pyx_XDECREF(__pyx_t_3);
3757
__Pyx_XDECREF(__pyx_t_4);
3758
__Pyx_AddTraceback("cysignals.memory.check_allocarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
3759
__pyx_r = NULL;
3760
__pyx_L0:;
3761
__Pyx_RefNannyFinishContext();
3762
return __pyx_r;
3763
}
3764
3765
/* "cysignals/memory.pxd":95
3766
*
3767
*
3768
* cdef inline void* check_reallocarray(void* ptr, size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
3769
* """
3770
* Re-allocate memory at ``ptr`` to hold ``nmemb`` elements of size
3771
*/
3772
3773
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_reallocarray(void *__pyx_v_ptr, size_t __pyx_v_nmemb, size_t __pyx_v_size) {
3774
size_t __pyx_v_n;
3775
void *__pyx_v_ret;
3776
void *__pyx_r;
3777
__Pyx_RefNannyDeclarations
3778
int __pyx_t_1;
3779
PyObject *__pyx_t_2 = NULL;
3780
PyObject *__pyx_t_3 = NULL;
3781
PyObject *__pyx_t_4 = NULL;
3782
__Pyx_RefNannySetupContext("check_reallocarray", 0);
3783
3784
/* "cysignals/memory.pxd":103
3785
* When ``nmemb`` equals 0, then free the memory at ``ptr``.
3786
* """
3787
* if nmemb == 0: # <<<<<<<<<<<<<<
3788
* sig_free(ptr)
3789
* return NULL
3790
*/
3791
__pyx_t_1 = ((__pyx_v_nmemb == 0) != 0);
3792
if (__pyx_t_1) {
3793
3794
/* "cysignals/memory.pxd":104
3795
* """
3796
* if nmemb == 0:
3797
* sig_free(ptr) # <<<<<<<<<<<<<<
3798
* return NULL
3799
* cdef size_t n = mul_overflowcheck(nmemb, size)
3800
*/
3801
sig_free(__pyx_v_ptr);
3802
3803
/* "cysignals/memory.pxd":105
3804
* if nmemb == 0:
3805
* sig_free(ptr)
3806
* return NULL # <<<<<<<<<<<<<<
3807
* cdef size_t n = mul_overflowcheck(nmemb, size)
3808
* cdef void* ret = sig_realloc(ptr, n)
3809
*/
3810
__pyx_r = NULL;
3811
goto __pyx_L0;
3812
3813
/* "cysignals/memory.pxd":103
3814
* When ``nmemb`` equals 0, then free the memory at ``ptr``.
3815
* """
3816
* if nmemb == 0: # <<<<<<<<<<<<<<
3817
* sig_free(ptr)
3818
* return NULL
3819
*/
3820
}
3821
3822
/* "cysignals/memory.pxd":106
3823
* sig_free(ptr)
3824
* return NULL
3825
* cdef size_t n = mul_overflowcheck(nmemb, size) # <<<<<<<<<<<<<<
3826
* cdef void* ret = sig_realloc(ptr, n)
3827
* if unlikely(ret == NULL):
3828
*/
3829
__pyx_v_n = __pyx_f_9cysignals_6memory_mul_overflowcheck(__pyx_v_nmemb, __pyx_v_size);
3830
3831
/* "cysignals/memory.pxd":107
3832
* return NULL
3833
* cdef size_t n = mul_overflowcheck(nmemb, size)
3834
* cdef void* ret = sig_realloc(ptr, n) # <<<<<<<<<<<<<<
3835
* if unlikely(ret == NULL):
3836
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
3837
*/
3838
__pyx_v_ret = sig_realloc(__pyx_v_ptr, __pyx_v_n);
3839
3840
/* "cysignals/memory.pxd":108
3841
* cdef size_t n = mul_overflowcheck(nmemb, size)
3842
* cdef void* ret = sig_realloc(ptr, n)
3843
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
3844
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
3845
* return ret
3846
*/
3847
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
3848
if (__pyx_t_1) {
3849
3850
/* "cysignals/memory.pxd":109
3851
* cdef void* ret = sig_realloc(ptr, n)
3852
* if unlikely(ret == NULL):
3853
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) # <<<<<<<<<<<<<<
3854
* return ret
3855
*
3856
*/
3857
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 109, __pyx_L1_error)
3858
__Pyx_GOTREF(__pyx_t_2);
3859
__pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 109, __pyx_L1_error)
3860
__Pyx_GOTREF(__pyx_t_3);
3861
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 109, __pyx_L1_error)
3862
__Pyx_GOTREF(__pyx_t_4);
3863
__Pyx_GIVEREF(__pyx_t_2);
3864
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
3865
__Pyx_GIVEREF(__pyx_t_3);
3866
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
3867
__pyx_t_2 = 0;
3868
__pyx_t_3 = 0;
3869
__pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_s_bytes, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 109, __pyx_L1_error)
3870
__Pyx_GOTREF(__pyx_t_3);
3871
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3872
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 109, __pyx_L1_error)
3873
__Pyx_GOTREF(__pyx_t_4);
3874
__Pyx_GIVEREF(__pyx_t_3);
3875
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
3876
__pyx_t_3 = 0;
3877
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 109, __pyx_L1_error)
3878
__Pyx_GOTREF(__pyx_t_3);
3879
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3880
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
3881
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3882
__PYX_ERR(2, 109, __pyx_L1_error)
3883
3884
/* "cysignals/memory.pxd":108
3885
* cdef size_t n = mul_overflowcheck(nmemb, size)
3886
* cdef void* ret = sig_realloc(ptr, n)
3887
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
3888
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
3889
* return ret
3890
*/
3891
}
3892
3893
/* "cysignals/memory.pxd":110
3894
* if unlikely(ret == NULL):
3895
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
3896
* return ret # <<<<<<<<<<<<<<
3897
*
3898
*
3899
*/
3900
__pyx_r = __pyx_v_ret;
3901
goto __pyx_L0;
3902
3903
/* "cysignals/memory.pxd":95
3904
*
3905
*
3906
* cdef inline void* check_reallocarray(void* ptr, size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
3907
* """
3908
* Re-allocate memory at ``ptr`` to hold ``nmemb`` elements of size
3909
*/
3910
3911
/* function exit code */
3912
__pyx_L1_error:;
3913
__Pyx_XDECREF(__pyx_t_2);
3914
__Pyx_XDECREF(__pyx_t_3);
3915
__Pyx_XDECREF(__pyx_t_4);
3916
__Pyx_AddTraceback("cysignals.memory.check_reallocarray", __pyx_clineno, __pyx_lineno, __pyx_filename);
3917
__pyx_r = NULL;
3918
__pyx_L0:;
3919
__Pyx_RefNannyFinishContext();
3920
return __pyx_r;
3921
}
3922
3923
/* "cysignals/memory.pxd":113
3924
*
3925
*
3926
* cdef inline void* check_malloc(size_t n) except? NULL: # <<<<<<<<<<<<<<
3927
* """
3928
* Allocate ``n`` bytes of memory.
3929
*/
3930
3931
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_malloc(size_t __pyx_v_n) {
3932
void *__pyx_v_ret;
3933
void *__pyx_r;
3934
__Pyx_RefNannyDeclarations
3935
int __pyx_t_1;
3936
PyObject *__pyx_t_2 = NULL;
3937
PyObject *__pyx_t_3 = NULL;
3938
__Pyx_RefNannySetupContext("check_malloc", 0);
3939
3940
/* "cysignals/memory.pxd":117
3941
* Allocate ``n`` bytes of memory.
3942
* """
3943
* if n == 0: # <<<<<<<<<<<<<<
3944
* return NULL
3945
* cdef void* ret = sig_malloc(n)
3946
*/
3947
__pyx_t_1 = ((__pyx_v_n == 0) != 0);
3948
if (__pyx_t_1) {
3949
3950
/* "cysignals/memory.pxd":118
3951
* """
3952
* if n == 0:
3953
* return NULL # <<<<<<<<<<<<<<
3954
* cdef void* ret = sig_malloc(n)
3955
* if unlikely(ret == NULL):
3956
*/
3957
__pyx_r = NULL;
3958
goto __pyx_L0;
3959
3960
/* "cysignals/memory.pxd":117
3961
* Allocate ``n`` bytes of memory.
3962
* """
3963
* if n == 0: # <<<<<<<<<<<<<<
3964
* return NULL
3965
* cdef void* ret = sig_malloc(n)
3966
*/
3967
}
3968
3969
/* "cysignals/memory.pxd":119
3970
* if n == 0:
3971
* return NULL
3972
* cdef void* ret = sig_malloc(n) # <<<<<<<<<<<<<<
3973
* if unlikely(ret == NULL):
3974
* raise MemoryError("failed to allocate %s bytes" % n)
3975
*/
3976
__pyx_v_ret = sig_malloc(__pyx_v_n);
3977
3978
/* "cysignals/memory.pxd":120
3979
* return NULL
3980
* cdef void* ret = sig_malloc(n)
3981
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
3982
* raise MemoryError("failed to allocate %s bytes" % n)
3983
* return ret
3984
*/
3985
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
3986
if (__pyx_t_1) {
3987
3988
/* "cysignals/memory.pxd":121
3989
* cdef void* ret = sig_malloc(n)
3990
* if unlikely(ret == NULL):
3991
* raise MemoryError("failed to allocate %s bytes" % n) # <<<<<<<<<<<<<<
3992
* return ret
3993
*
3994
*/
3995
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 121, __pyx_L1_error)
3996
__Pyx_GOTREF(__pyx_t_2);
3997
__pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_bytes, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 121, __pyx_L1_error)
3998
__Pyx_GOTREF(__pyx_t_3);
3999
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4000
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 121, __pyx_L1_error)
4001
__Pyx_GOTREF(__pyx_t_2);
4002
__Pyx_GIVEREF(__pyx_t_3);
4003
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
4004
__pyx_t_3 = 0;
4005
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 121, __pyx_L1_error)
4006
__Pyx_GOTREF(__pyx_t_3);
4007
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4008
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
4009
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4010
__PYX_ERR(2, 121, __pyx_L1_error)
4011
4012
/* "cysignals/memory.pxd":120
4013
* return NULL
4014
* cdef void* ret = sig_malloc(n)
4015
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
4016
* raise MemoryError("failed to allocate %s bytes" % n)
4017
* return ret
4018
*/
4019
}
4020
4021
/* "cysignals/memory.pxd":122
4022
* if unlikely(ret == NULL):
4023
* raise MemoryError("failed to allocate %s bytes" % n)
4024
* return ret # <<<<<<<<<<<<<<
4025
*
4026
*
4027
*/
4028
__pyx_r = __pyx_v_ret;
4029
goto __pyx_L0;
4030
4031
/* "cysignals/memory.pxd":113
4032
*
4033
*
4034
* cdef inline void* check_malloc(size_t n) except? NULL: # <<<<<<<<<<<<<<
4035
* """
4036
* Allocate ``n`` bytes of memory.
4037
*/
4038
4039
/* function exit code */
4040
__pyx_L1_error:;
4041
__Pyx_XDECREF(__pyx_t_2);
4042
__Pyx_XDECREF(__pyx_t_3);
4043
__Pyx_AddTraceback("cysignals.memory.check_malloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
4044
__pyx_r = NULL;
4045
__pyx_L0:;
4046
__Pyx_RefNannyFinishContext();
4047
return __pyx_r;
4048
}
4049
4050
/* "cysignals/memory.pxd":125
4051
*
4052
*
4053
* cdef inline void* check_realloc(void* ptr, size_t n) except? NULL: # <<<<<<<<<<<<<<
4054
* """
4055
* Re-allocate memory at ``ptr`` to hold ``n`` bytes.
4056
*/
4057
4058
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_realloc(void *__pyx_v_ptr, size_t __pyx_v_n) {
4059
void *__pyx_v_ret;
4060
void *__pyx_r;
4061
__Pyx_RefNannyDeclarations
4062
int __pyx_t_1;
4063
PyObject *__pyx_t_2 = NULL;
4064
PyObject *__pyx_t_3 = NULL;
4065
__Pyx_RefNannySetupContext("check_realloc", 0);
4066
4067
/* "cysignals/memory.pxd":130
4068
* If ``ptr`` equals ``NULL``, this behaves as ``check_malloc``.
4069
* """
4070
* if n == 0: # <<<<<<<<<<<<<<
4071
* sig_free(ptr)
4072
* return NULL
4073
*/
4074
__pyx_t_1 = ((__pyx_v_n == 0) != 0);
4075
if (__pyx_t_1) {
4076
4077
/* "cysignals/memory.pxd":131
4078
* """
4079
* if n == 0:
4080
* sig_free(ptr) # <<<<<<<<<<<<<<
4081
* return NULL
4082
* cdef void* ret = sig_realloc(ptr, n)
4083
*/
4084
sig_free(__pyx_v_ptr);
4085
4086
/* "cysignals/memory.pxd":132
4087
* if n == 0:
4088
* sig_free(ptr)
4089
* return NULL # <<<<<<<<<<<<<<
4090
* cdef void* ret = sig_realloc(ptr, n)
4091
* if unlikely(ret == NULL):
4092
*/
4093
__pyx_r = NULL;
4094
goto __pyx_L0;
4095
4096
/* "cysignals/memory.pxd":130
4097
* If ``ptr`` equals ``NULL``, this behaves as ``check_malloc``.
4098
* """
4099
* if n == 0: # <<<<<<<<<<<<<<
4100
* sig_free(ptr)
4101
* return NULL
4102
*/
4103
}
4104
4105
/* "cysignals/memory.pxd":133
4106
* sig_free(ptr)
4107
* return NULL
4108
* cdef void* ret = sig_realloc(ptr, n) # <<<<<<<<<<<<<<
4109
* if unlikely(ret == NULL):
4110
* raise MemoryError("failed to allocate %s bytes" % n)
4111
*/
4112
__pyx_v_ret = sig_realloc(__pyx_v_ptr, __pyx_v_n);
4113
4114
/* "cysignals/memory.pxd":134
4115
* return NULL
4116
* cdef void* ret = sig_realloc(ptr, n)
4117
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
4118
* raise MemoryError("failed to allocate %s bytes" % n)
4119
* return ret
4120
*/
4121
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
4122
if (__pyx_t_1) {
4123
4124
/* "cysignals/memory.pxd":135
4125
* cdef void* ret = sig_realloc(ptr, n)
4126
* if unlikely(ret == NULL):
4127
* raise MemoryError("failed to allocate %s bytes" % n) # <<<<<<<<<<<<<<
4128
* return ret
4129
*
4130
*/
4131
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 135, __pyx_L1_error)
4132
__Pyx_GOTREF(__pyx_t_2);
4133
__pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_bytes, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 135, __pyx_L1_error)
4134
__Pyx_GOTREF(__pyx_t_3);
4135
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4136
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 135, __pyx_L1_error)
4137
__Pyx_GOTREF(__pyx_t_2);
4138
__Pyx_GIVEREF(__pyx_t_3);
4139
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
4140
__pyx_t_3 = 0;
4141
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 135, __pyx_L1_error)
4142
__Pyx_GOTREF(__pyx_t_3);
4143
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4144
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
4145
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4146
__PYX_ERR(2, 135, __pyx_L1_error)
4147
4148
/* "cysignals/memory.pxd":134
4149
* return NULL
4150
* cdef void* ret = sig_realloc(ptr, n)
4151
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
4152
* raise MemoryError("failed to allocate %s bytes" % n)
4153
* return ret
4154
*/
4155
}
4156
4157
/* "cysignals/memory.pxd":136
4158
* if unlikely(ret == NULL):
4159
* raise MemoryError("failed to allocate %s bytes" % n)
4160
* return ret # <<<<<<<<<<<<<<
4161
*
4162
*
4163
*/
4164
__pyx_r = __pyx_v_ret;
4165
goto __pyx_L0;
4166
4167
/* "cysignals/memory.pxd":125
4168
*
4169
*
4170
* cdef inline void* check_realloc(void* ptr, size_t n) except? NULL: # <<<<<<<<<<<<<<
4171
* """
4172
* Re-allocate memory at ``ptr`` to hold ``n`` bytes.
4173
*/
4174
4175
/* function exit code */
4176
__pyx_L1_error:;
4177
__Pyx_XDECREF(__pyx_t_2);
4178
__Pyx_XDECREF(__pyx_t_3);
4179
__Pyx_AddTraceback("cysignals.memory.check_realloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
4180
__pyx_r = NULL;
4181
__pyx_L0:;
4182
__Pyx_RefNannyFinishContext();
4183
return __pyx_r;
4184
}
4185
4186
/* "cysignals/memory.pxd":139
4187
*
4188
*
4189
* cdef inline void* check_calloc(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
4190
* """
4191
* Allocate memory for ``nmemb`` elements of size ``size``. The
4192
*/
4193
4194
static CYTHON_INLINE void *__pyx_f_9cysignals_6memory_check_calloc(size_t __pyx_v_nmemb, size_t __pyx_v_size) {
4195
void *__pyx_v_ret;
4196
void *__pyx_r;
4197
__Pyx_RefNannyDeclarations
4198
int __pyx_t_1;
4199
PyObject *__pyx_t_2 = NULL;
4200
PyObject *__pyx_t_3 = NULL;
4201
PyObject *__pyx_t_4 = NULL;
4202
__Pyx_RefNannySetupContext("check_calloc", 0);
4203
4204
/* "cysignals/memory.pxd":144
4205
* resulting memory is zeroed.
4206
* """
4207
* if nmemb == 0: # <<<<<<<<<<<<<<
4208
* return NULL
4209
* cdef void* ret = sig_calloc(nmemb, size)
4210
*/
4211
__pyx_t_1 = ((__pyx_v_nmemb == 0) != 0);
4212
if (__pyx_t_1) {
4213
4214
/* "cysignals/memory.pxd":145
4215
* """
4216
* if nmemb == 0:
4217
* return NULL # <<<<<<<<<<<<<<
4218
* cdef void* ret = sig_calloc(nmemb, size)
4219
* if unlikely(ret == NULL):
4220
*/
4221
__pyx_r = NULL;
4222
goto __pyx_L0;
4223
4224
/* "cysignals/memory.pxd":144
4225
* resulting memory is zeroed.
4226
* """
4227
* if nmemb == 0: # <<<<<<<<<<<<<<
4228
* return NULL
4229
* cdef void* ret = sig_calloc(nmemb, size)
4230
*/
4231
}
4232
4233
/* "cysignals/memory.pxd":146
4234
* if nmemb == 0:
4235
* return NULL
4236
* cdef void* ret = sig_calloc(nmemb, size) # <<<<<<<<<<<<<<
4237
* if unlikely(ret == NULL):
4238
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
4239
*/
4240
__pyx_v_ret = sig_calloc(__pyx_v_nmemb, __pyx_v_size);
4241
4242
/* "cysignals/memory.pxd":147
4243
* return NULL
4244
* cdef void* ret = sig_calloc(nmemb, size)
4245
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
4246
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
4247
* return ret
4248
*/
4249
__pyx_t_1 = (unlikely((__pyx_v_ret == NULL)) != 0);
4250
if (__pyx_t_1) {
4251
4252
/* "cysignals/memory.pxd":148
4253
* cdef void* ret = sig_calloc(nmemb, size)
4254
* if unlikely(ret == NULL):
4255
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size)) # <<<<<<<<<<<<<<
4256
* return ret
4257
*/
4258
__pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_nmemb); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 148, __pyx_L1_error)
4259
__Pyx_GOTREF(__pyx_t_2);
4260
__pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error)
4261
__Pyx_GOTREF(__pyx_t_3);
4262
__pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 148, __pyx_L1_error)
4263
__Pyx_GOTREF(__pyx_t_4);
4264
__Pyx_GIVEREF(__pyx_t_2);
4265
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
4266
__Pyx_GIVEREF(__pyx_t_3);
4267
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
4268
__pyx_t_2 = 0;
4269
__pyx_t_3 = 0;
4270
__pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_allocate_s_s_bytes, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error)
4271
__Pyx_GOTREF(__pyx_t_3);
4272
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4273
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 148, __pyx_L1_error)
4274
__Pyx_GOTREF(__pyx_t_4);
4275
__Pyx_GIVEREF(__pyx_t_3);
4276
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
4277
__pyx_t_3 = 0;
4278
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error)
4279
__Pyx_GOTREF(__pyx_t_3);
4280
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4281
__Pyx_Raise(__pyx_t_3, 0, 0, 0);
4282
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4283
__PYX_ERR(2, 148, __pyx_L1_error)
4284
4285
/* "cysignals/memory.pxd":147
4286
* return NULL
4287
* cdef void* ret = sig_calloc(nmemb, size)
4288
* if unlikely(ret == NULL): # <<<<<<<<<<<<<<
4289
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
4290
* return ret
4291
*/
4292
}
4293
4294
/* "cysignals/memory.pxd":149
4295
* if unlikely(ret == NULL):
4296
* raise MemoryError("failed to allocate %s * %s bytes" % (nmemb, size))
4297
* return ret # <<<<<<<<<<<<<<
4298
*/
4299
__pyx_r = __pyx_v_ret;
4300
goto __pyx_L0;
4301
4302
/* "cysignals/memory.pxd":139
4303
*
4304
*
4305
* cdef inline void* check_calloc(size_t nmemb, size_t size) except? NULL: # <<<<<<<<<<<<<<
4306
* """
4307
* Allocate memory for ``nmemb`` elements of size ``size``. The
4308
*/
4309
4310
/* function exit code */
4311
__pyx_L1_error:;
4312
__Pyx_XDECREF(__pyx_t_2);
4313
__Pyx_XDECREF(__pyx_t_3);
4314
__Pyx_XDECREF(__pyx_t_4);
4315
__Pyx_AddTraceback("cysignals.memory.check_calloc", __pyx_clineno, __pyx_lineno, __pyx_filename);
4316
__pyx_r = NULL;
4317
__pyx_L0:;
4318
__Pyx_RefNannyFinishContext();
4319
return __pyx_r;
4320
}
4321
4322
/* "sage/ext/stdsage.pxd":16
4323
*
4324
*
4325
* cdef inline PY_NEW(type t): # <<<<<<<<<<<<<<
4326
* """
4327
* Return ``t.__new__(t)``. This works even for types like
4328
*/
4329
4330
static CYTHON_INLINE PyObject *__pyx_f_4sage_3ext_7stdsage_PY_NEW(PyTypeObject *__pyx_v_t) {
4331
PyObject *__pyx_r = NULL;
4332
__Pyx_RefNannyDeclarations
4333
PyObject *__pyx_t_1 = NULL;
4334
__Pyx_RefNannySetupContext("PY_NEW", 0);
4335
4336
/* "sage/ext/stdsage.pxd":22
4337
* optimizations assume that ``tp_new`` doesn't change).
4338
* """
4339
* return (<PyTypeObject*>t).tp_new(t, <object>NULL, <object>NULL) # <<<<<<<<<<<<<<
4340
*
4341
*
4342
*/
4343
__Pyx_XDECREF(__pyx_r);
4344
__pyx_t_1 = ((PyTypeObject *)__pyx_v_t)->tp_new(((PyTypeObject *)__pyx_v_t), ((PyObject *)NULL), ((PyObject *)NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 22, __pyx_L1_error)
4345
__Pyx_GOTREF(__pyx_t_1);
4346
__pyx_r = __pyx_t_1;
4347
__pyx_t_1 = 0;
4348
goto __pyx_L0;
4349
4350
/* "sage/ext/stdsage.pxd":16
4351
*
4352
*
4353
* cdef inline PY_NEW(type t): # <<<<<<<<<<<<<<
4354
* """
4355
* Return ``t.__new__(t)``. This works even for types like
4356
*/
4357
4358
/* function exit code */
4359
__pyx_L1_error:;
4360
__Pyx_XDECREF(__pyx_t_1);
4361
__Pyx_AddTraceback("sage.ext.stdsage.PY_NEW", __pyx_clineno, __pyx_lineno, __pyx_filename);
4362
__pyx_r = 0;
4363
__pyx_L0:;
4364
__Pyx_XGIVEREF(__pyx_r);
4365
__Pyx_RefNannyFinishContext();
4366
return __pyx_r;
4367
}
4368
4369
/* "sage/ext/stdsage.pxd":25
4370
*
4371
*
4372
* cdef inline void PY_SET_TP_NEW(type dst, type src): # <<<<<<<<<<<<<<
4373
* """
4374
* Manually set ``dst.__new__`` to ``src.__new__``. This is used to
4375
*/
4376
4377
static CYTHON_INLINE void __pyx_f_4sage_3ext_7stdsage_PY_SET_TP_NEW(PyTypeObject *__pyx_v_dst, PyTypeObject *__pyx_v_src) {
4378
__Pyx_RefNannyDeclarations
4379
newfunc __pyx_t_1;
4380
__Pyx_RefNannySetupContext("PY_SET_TP_NEW", 0);
4381
4382
/* "sage/ext/stdsage.pxd":31
4383
* irrelevant base class ``tp_new`` methods.
4384
* """
4385
* (<PyTypeObject*>dst).tp_new = (<PyTypeObject*>src).tp_new # <<<<<<<<<<<<<<
4386
*
4387
*
4388
*/
4389
__pyx_t_1 = ((PyTypeObject *)__pyx_v_src)->tp_new;
4390
((PyTypeObject *)__pyx_v_dst)->tp_new = __pyx_t_1;
4391
4392
/* "sage/ext/stdsage.pxd":25
4393
*
4394
*
4395
* cdef inline void PY_SET_TP_NEW(type dst, type src): # <<<<<<<<<<<<<<
4396
* """
4397
* Manually set ``dst.__new__`` to ``src.__new__``. This is used to
4398
*/
4399
4400
/* function exit code */
4401
__Pyx_RefNannyFinishContext();
4402
}
4403
4404
/* "sage/ext/stdsage.pxd":34
4405
*
4406
*
4407
* cdef inline bint HAS_DICTIONARY(obj): # <<<<<<<<<<<<<<
4408
* """
4409
* Test whether the given object has a Python dictionary.
4410
*/
4411
4412
static CYTHON_INLINE int __pyx_f_4sage_3ext_7stdsage_HAS_DICTIONARY(PyObject *__pyx_v_obj) {
4413
int __pyx_r;
4414
__Pyx_RefNannyDeclarations
4415
__Pyx_RefNannySetupContext("HAS_DICTIONARY", 0);
4416
4417
/* "sage/ext/stdsage.pxd":38
4418
* Test whether the given object has a Python dictionary.
4419
* """
4420
* return Py_TYPE(obj).tp_dictoffset != 0 # <<<<<<<<<<<<<<
4421
*/
4422
__pyx_r = (Py_TYPE(__pyx_v_obj)->tp_dictoffset != 0);
4423
goto __pyx_L0;
4424
4425
/* "sage/ext/stdsage.pxd":34
4426
*
4427
*
4428
* cdef inline bint HAS_DICTIONARY(obj): # <<<<<<<<<<<<<<
4429
* """
4430
* Test whether the given object has a Python dictionary.
4431
*/
4432
4433
/* function exit code */
4434
__pyx_L0:;
4435
__Pyx_RefNannyFinishContext();
4436
return __pyx_r;
4437
}
4438
4439
/* "cysignals/signals.pxd":35
4440
* # (PyErr_Occurred() is non-NULL). To Cython, it will look like
4441
* # cython_check_exception() actually raised the exception.
4442
* cdef inline void cython_check_exception() nogil except *: # <<<<<<<<<<<<<<
4443
* pass
4444
*
4445
*/
4446
4447
static CYTHON_INLINE void __pyx_f_9cysignals_7signals_cython_check_exception(void) {
4448
4449
/* function exit code */
4450
}
4451
static struct __pyx_vtabstruct_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac __pyx_vtable_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac;
4452
4453
static PyObject *__pyx_tp_new_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
4454
struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *p;
4455
PyObject *o;
4456
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
4457
o = (*t->tp_alloc)(t, 0);
4458
} else {
4459
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
4460
}
4461
if (unlikely(!o)) return 0;
4462
p = ((struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)o);
4463
p->__pyx_vtab = __pyx_vtabptr_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac;
4464
p->tmp = Py_None; Py_INCREF(Py_None);
4465
if (unlikely(__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad;
4466
return o;
4467
bad:
4468
Py_DECREF(o); o = 0;
4469
return NULL;
4470
}
4471
4472
static void __pyx_tp_dealloc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac(PyObject *o) {
4473
struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *p = (struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)o;
4474
#if PY_VERSION_HEX >= 0x030400a1
4475
if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
4476
if (PyObject_CallFinalizerFromDealloc(o)) return;
4477
}
4478
#endif
4479
PyObject_GC_UnTrack(o);
4480
{
4481
PyObject *etype, *eval, *etb;
4482
PyErr_Fetch(&etype, &eval, &etb);
4483
++Py_REFCNT(o);
4484
__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_7__dealloc__(o);
4485
--Py_REFCNT(o);
4486
PyErr_Restore(etype, eval, etb);
4487
}
4488
Py_CLEAR(p->tmp);
4489
(*Py_TYPE(o)->tp_free)(o);
4490
}
4491
4492
static int __pyx_tp_traverse_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac(PyObject *o, visitproc v, void *a) {
4493
int e;
4494
struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *p = (struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)o;
4495
if (p->tmp) {
4496
e = (*v)(p->tmp, a); if (e) return e;
4497
}
4498
return 0;
4499
}
4500
4501
static int __pyx_tp_clear_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac(PyObject *o) {
4502
PyObject* tmp;
4503
struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *p = (struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *)o;
4504
tmp = ((PyObject*)p->tmp);
4505
p->tmp = Py_None; Py_INCREF(Py_None);
4506
Py_XDECREF(tmp);
4507
return 0;
4508
}
4509
4510
static PyMethodDef __pyx_methods_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac[] = {
4511
{"genus", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_9genus, METH_NOARGS, __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_8genus},
4512
{"ap", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_11ap, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_10ap},
4513
{"frob", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_13frob, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_12frob},
4514
{"group", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_15group, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_14group},
4515
{0, 0, 0, 0}
4516
};
4517
4518
static PyTypeObject __pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac = {
4519
PyVarObject_HEAD_INIT(0, 0)
4520
"code.alex.psage.psage.libs.smalljac.wrapper2.SmallJac", /*tp_name*/
4521
sizeof(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac), /*tp_basicsize*/
4522
0, /*tp_itemsize*/
4523
__pyx_tp_dealloc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac, /*tp_dealloc*/
4524
0, /*tp_print*/
4525
0, /*tp_getattr*/
4526
0, /*tp_setattr*/
4527
#if PY_MAJOR_VERSION < 3
4528
0, /*tp_compare*/
4529
#endif
4530
#if PY_MAJOR_VERSION >= 3
4531
0, /*tp_as_async*/
4532
#endif
4533
__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_5__repr__, /*tp_repr*/
4534
0, /*tp_as_number*/
4535
0, /*tp_as_sequence*/
4536
0, /*tp_as_mapping*/
4537
0, /*tp_hash*/
4538
0, /*tp_call*/
4539
0, /*tp_str*/
4540
0, /*tp_getattro*/
4541
0, /*tp_setattro*/
4542
0, /*tp_as_buffer*/
4543
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
4544
0, /*tp_doc*/
4545
__pyx_tp_traverse_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac, /*tp_traverse*/
4546
__pyx_tp_clear_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac, /*tp_clear*/
4547
0, /*tp_richcompare*/
4548
0, /*tp_weaklistoffset*/
4549
0, /*tp_iter*/
4550
0, /*tp_iternext*/
4551
__pyx_methods_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac, /*tp_methods*/
4552
0, /*tp_members*/
4553
0, /*tp_getset*/
4554
0, /*tp_base*/
4555
0, /*tp_dict*/
4556
0, /*tp_descr_get*/
4557
0, /*tp_descr_set*/
4558
0, /*tp_dictoffset*/
4559
__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_3__init__, /*tp_init*/
4560
0, /*tp_alloc*/
4561
__pyx_tp_new_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac, /*tp_new*/
4562
0, /*tp_free*/
4563
0, /*tp_is_gc*/
4564
0, /*tp_bases*/
4565
0, /*tp_mro*/
4566
0, /*tp_cache*/
4567
0, /*tp_subclasses*/
4568
0, /*tp_weaklist*/
4569
0, /*tp_del*/
4570
0, /*tp_version_tag*/
4571
#if PY_VERSION_HEX >= 0x030400a1
4572
0, /*tp_finalize*/
4573
#endif
4574
};
4575
4576
static PyObject *__pyx_tp_new_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_GroupModp(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
4577
PyObject *o;
4578
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
4579
o = (*t->tp_alloc)(t, 0);
4580
} else {
4581
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
4582
}
4583
if (unlikely(!o)) return 0;
4584
return o;
4585
}
4586
4587
static void __pyx_tp_dealloc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_GroupModp(PyObject *o) {
4588
#if PY_VERSION_HEX >= 0x030400a1
4589
if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
4590
if (PyObject_CallFinalizerFromDealloc(o)) return;
4591
}
4592
#endif
4593
(*Py_TYPE(o)->tp_free)(o);
4594
}
4595
4596
static PyTypeObject __pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_GroupModp = {
4597
PyVarObject_HEAD_INIT(0, 0)
4598
"code.alex.psage.psage.libs.smalljac.wrapper2.GroupModp", /*tp_name*/
4599
sizeof(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_GroupModp), /*tp_basicsize*/
4600
0, /*tp_itemsize*/
4601
__pyx_tp_dealloc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_GroupModp, /*tp_dealloc*/
4602
0, /*tp_print*/
4603
0, /*tp_getattr*/
4604
0, /*tp_setattr*/
4605
#if PY_MAJOR_VERSION < 3
4606
0, /*tp_compare*/
4607
#endif
4608
#if PY_MAJOR_VERSION >= 3
4609
0, /*tp_as_async*/
4610
#endif
4611
0, /*tp_repr*/
4612
0, /*tp_as_number*/
4613
0, /*tp_as_sequence*/
4614
0, /*tp_as_mapping*/
4615
0, /*tp_hash*/
4616
0, /*tp_call*/
4617
0, /*tp_str*/
4618
0, /*tp_getattro*/
4619
0, /*tp_setattro*/
4620
0, /*tp_as_buffer*/
4621
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
4622
0, /*tp_doc*/
4623
0, /*tp_traverse*/
4624
0, /*tp_clear*/
4625
0, /*tp_richcompare*/
4626
0, /*tp_weaklistoffset*/
4627
0, /*tp_iter*/
4628
0, /*tp_iternext*/
4629
0, /*tp_methods*/
4630
0, /*tp_members*/
4631
0, /*tp_getset*/
4632
0, /*tp_base*/
4633
0, /*tp_dict*/
4634
0, /*tp_descr_get*/
4635
0, /*tp_descr_set*/
4636
0, /*tp_dictoffset*/
4637
0, /*tp_init*/
4638
0, /*tp_alloc*/
4639
__pyx_tp_new_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_GroupModp, /*tp_new*/
4640
0, /*tp_free*/
4641
0, /*tp_is_gc*/
4642
0, /*tp_bases*/
4643
0, /*tp_mro*/
4644
0, /*tp_cache*/
4645
0, /*tp_subclasses*/
4646
0, /*tp_weaklist*/
4647
0, /*tp_del*/
4648
0, /*tp_version_tag*/
4649
#if PY_VERSION_HEX >= 0x030400a1
4650
0, /*tp_finalize*/
4651
#endif
4652
};
4653
4654
static PyObject *__pyx_tp_new_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
4655
PyObject *o;
4656
if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
4657
o = (*t->tp_alloc)(t, 0);
4658
} else {
4659
o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
4660
}
4661
if (unlikely(!o)) return 0;
4662
return o;
4663
}
4664
4665
static void __pyx_tp_dealloc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly(PyObject *o) {
4666
#if PY_VERSION_HEX >= 0x030400a1
4667
if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
4668
if (PyObject_CallFinalizerFromDealloc(o)) return;
4669
}
4670
#endif
4671
(*Py_TYPE(o)->tp_free)(o);
4672
}
4673
4674
static PyMethodDef __pyx_methods_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly[] = {
4675
{"__reduce__", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_3__reduce__, METH_NOARGS, __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_2__reduce__},
4676
{"prime", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_7prime, METH_NOARGS, __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_6prime},
4677
{"trace", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_9trace, METH_NOARGS, __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_8trace},
4678
{"characteristic_polynomial", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_11characteristic_polynomial, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_10characteristic_polynomial},
4679
{0, 0, 0, 0}
4680
};
4681
4682
static PyTypeObject __pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly = {
4683
PyVarObject_HEAD_INIT(0, 0)
4684
"code.alex.psage.psage.libs.smalljac.wrapper2.FrobPoly", /*tp_name*/
4685
sizeof(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly), /*tp_basicsize*/
4686
0, /*tp_itemsize*/
4687
__pyx_tp_dealloc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly, /*tp_dealloc*/
4688
0, /*tp_print*/
4689
0, /*tp_getattr*/
4690
0, /*tp_setattr*/
4691
#if PY_MAJOR_VERSION < 3
4692
0, /*tp_compare*/
4693
#endif
4694
#if PY_MAJOR_VERSION >= 3
4695
0, /*tp_as_async*/
4696
#endif
4697
__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_5__repr__, /*tp_repr*/
4698
0, /*tp_as_number*/
4699
0, /*tp_as_sequence*/
4700
0, /*tp_as_mapping*/
4701
0, /*tp_hash*/
4702
0, /*tp_call*/
4703
0, /*tp_str*/
4704
0, /*tp_getattro*/
4705
0, /*tp_setattro*/
4706
0, /*tp_as_buffer*/
4707
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
4708
0, /*tp_doc*/
4709
0, /*tp_traverse*/
4710
0, /*tp_clear*/
4711
0, /*tp_richcompare*/
4712
0, /*tp_weaklistoffset*/
4713
0, /*tp_iter*/
4714
0, /*tp_iternext*/
4715
__pyx_methods_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly, /*tp_methods*/
4716
0, /*tp_members*/
4717
0, /*tp_getset*/
4718
0, /*tp_base*/
4719
0, /*tp_dict*/
4720
0, /*tp_descr_get*/
4721
0, /*tp_descr_set*/
4722
0, /*tp_dictoffset*/
4723
__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_1__init__, /*tp_init*/
4724
0, /*tp_alloc*/
4725
__pyx_tp_new_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly, /*tp_new*/
4726
0, /*tp_free*/
4727
0, /*tp_is_gc*/
4728
0, /*tp_bases*/
4729
0, /*tp_mro*/
4730
0, /*tp_cache*/
4731
0, /*tp_subclasses*/
4732
0, /*tp_weaklist*/
4733
0, /*tp_del*/
4734
0, /*tp_version_tag*/
4735
#if PY_VERSION_HEX >= 0x030400a1
4736
0, /*tp_finalize*/
4737
#endif
4738
};
4739
4740
static PyMethodDef __pyx_methods[] = {
4741
{"FrobPoly_new", (PyCFunction)__pyx_pw_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_1FrobPoly_new, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly_new},
4742
{0, 0, 0, 0}
4743
};
4744
4745
#if PY_MAJOR_VERSION >= 3
4746
static struct PyModuleDef __pyx_moduledef = {
4747
#if PY_VERSION_HEX < 0x03020000
4748
{ PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
4749
#else
4750
PyModuleDef_HEAD_INIT,
4751
#endif
4752
"wrapper2",
4753
__pyx_k_File_wrapper2_pyx_starting_at_li, /* m_doc */
4754
-1, /* m_size */
4755
__pyx_methods /* m_methods */,
4756
NULL, /* m_reload */
4757
NULL, /* m_traverse */
4758
NULL, /* m_clear */
4759
NULL /* m_free */
4760
};
4761
#endif
4762
4763
static __Pyx_StringTabEntry __pyx_string_tab[] = {
4764
{&__pyx_kp_s_Error_code_s, __pyx_k_Error_code_s, sizeof(__pyx_k_Error_code_s), 0, 0, 1, 0},
4765
{&__pyx_n_s_FrobPoly_new, __pyx_k_FrobPoly_new, sizeof(__pyx_k_FrobPoly_new), 0, 0, 1, 1},
4766
{&__pyx_kp_s_Frobenius_in_characteristic_s_wi, __pyx_k_Frobenius_in_characteristic_s_wi, sizeof(__pyx_k_Frobenius_in_characteristic_s_wi), 0, 0, 1, 0},
4767
{&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
4768
{&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
4769
{&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
4770
{&__pyx_kp_s_Smalljac_curve_defined_by_s, __pyx_k_Smalljac_curve_defined_by_s, sizeof(__pyx_k_Smalljac_curve_defined_by_s), 0, 0, 1, 0},
4771
{&__pyx_n_s_ZZ, __pyx_k_ZZ, sizeof(__pyx_k_ZZ), 0, 0, 1, 1},
4772
{&__pyx_n_s_a0, __pyx_k_a0, sizeof(__pyx_k_a0), 0, 0, 1, 1},
4773
{&__pyx_n_s_a1, __pyx_k_a1, sizeof(__pyx_k_a1), 0, 0, 1, 1},
4774
{&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
4775
{&__pyx_n_s_characteristic_polynomial, __pyx_k_characteristic_polynomial, sizeof(__pyx_k_characteristic_polynomial), 0, 0, 1, 1},
4776
{&__pyx_n_s_charpoly, __pyx_k_charpoly, sizeof(__pyx_k_charpoly), 0, 0, 1, 1},
4777
{&__pyx_kp_s_failed_to_allocate_s_bytes, __pyx_k_failed_to_allocate_s_bytes, sizeof(__pyx_k_failed_to_allocate_s_bytes), 0, 0, 1, 0},
4778
{&__pyx_kp_s_failed_to_allocate_s_s_bytes, __pyx_k_failed_to_allocate_s_s_bytes, sizeof(__pyx_k_failed_to_allocate_s_s_bytes), 0, 0, 1, 0},
4779
{&__pyx_n_s_genus, __pyx_k_genus, sizeof(__pyx_k_genus), 0, 0, 1, 1},
4780
{&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
4781
{&__pyx_n_s_init_memory_functions, __pyx_k_init_memory_functions, sizeof(__pyx_k_init_memory_functions), 0, 0, 1, 1},
4782
{&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
4783
{&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
4784
{&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
4785
{&__pyx_n_s_sage_ext_memory, __pyx_k_sage_ext_memory, sizeof(__pyx_k_sage_ext_memory), 0, 0, 1, 1},
4786
{&__pyx_n_s_sage_rings_all, __pyx_k_sage_rings_all, sizeof(__pyx_k_sage_rings_all), 0, 0, 1, 1},
4787
{&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
4788
{&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
4789
{&__pyx_n_s_var, __pyx_k_var, sizeof(__pyx_k_var), 0, 0, 1, 1},
4790
{&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
4791
{0, 0, 0, 0, 0, 0, 0}
4792
};
4793
static int __Pyx_InitCachedBuiltins(void) {
4794
__pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 16, __pyx_L1_error)
4795
__pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 90, __pyx_L1_error)
4796
__pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 91, __pyx_L1_error)
4797
return 0;
4798
__pyx_L1_error:;
4799
return -1;
4800
}
4801
4802
static int __Pyx_InitCachedConstants(void) {
4803
__Pyx_RefNannyDeclarations
4804
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
4805
__Pyx_RefNannyFinishContext();
4806
return 0;
4807
}
4808
4809
static int __Pyx_InitGlobals(void) {
4810
if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(1, 1, __pyx_L1_error);
4811
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(1, 1, __pyx_L1_error)
4812
return 0;
4813
__pyx_L1_error:;
4814
return -1;
4815
}
4816
4817
#if PY_MAJOR_VERSION < 3
4818
PyMODINIT_FUNC initwrapper2(void); /*proto*/
4819
PyMODINIT_FUNC initwrapper2(void)
4820
#else
4821
PyMODINIT_FUNC PyInit_wrapper2(void); /*proto*/
4822
PyMODINIT_FUNC PyInit_wrapper2(void)
4823
#endif
4824
{
4825
PyObject *__pyx_t_1 = NULL;
4826
int __pyx_t_2;
4827
PyObject *__pyx_t_3 = NULL;
4828
PyObject *__pyx_t_4 = NULL;
4829
__Pyx_RefNannyDeclarations
4830
#if CYTHON_REFNANNY
4831
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
4832
if (!__Pyx_RefNanny) {
4833
PyErr_Clear();
4834
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
4835
if (!__Pyx_RefNanny)
4836
Py_FatalError("failed to import 'refnanny' module");
4837
}
4838
#endif
4839
__Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_wrapper2(void)", 0);
4840
if (__Pyx_check_binary_version() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4841
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(1, 1, __pyx_L1_error)
4842
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(1, 1, __pyx_L1_error)
4843
__pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(1, 1, __pyx_L1_error)
4844
#ifdef __Pyx_CyFunction_USED
4845
if (__pyx_CyFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4846
#endif
4847
#ifdef __Pyx_FusedFunction_USED
4848
if (__pyx_FusedFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4849
#endif
4850
#ifdef __Pyx_Coroutine_USED
4851
if (__pyx_Coroutine_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4852
#endif
4853
#ifdef __Pyx_Generator_USED
4854
if (__pyx_Generator_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4855
#endif
4856
#ifdef __Pyx_StopAsyncIteration_USED
4857
if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4858
#endif
4859
/*--- Library function declarations ---*/
4860
/*--- Threads initialization code ---*/
4861
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
4862
#ifdef WITH_THREAD /* Python build with threading support? */
4863
PyEval_InitThreads();
4864
#endif
4865
#endif
4866
/*--- Module creation code ---*/
4867
#if PY_MAJOR_VERSION < 3
4868
__pyx_m = Py_InitModule4("wrapper2", __pyx_methods, __pyx_k_File_wrapper2_pyx_starting_at_li, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
4869
#else
4870
__pyx_m = PyModule_Create(&__pyx_moduledef);
4871
#endif
4872
if (unlikely(!__pyx_m)) __PYX_ERR(1, 1, __pyx_L1_error)
4873
__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(1, 1, __pyx_L1_error)
4874
Py_INCREF(__pyx_d);
4875
__pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(1, 1, __pyx_L1_error)
4876
#if CYTHON_COMPILING_IN_PYPY
4877
Py_INCREF(__pyx_b);
4878
#endif
4879
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(1, 1, __pyx_L1_error);
4880
/*--- Initialize various global constants etc. ---*/
4881
if (__Pyx_InitGlobals() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4882
#if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
4883
if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4884
#endif
4885
if (__pyx_module_is_main_code__alex__psage__psage__libs__smalljac__wrapper2) {
4886
if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4887
}
4888
#if PY_MAJOR_VERSION >= 3
4889
{
4890
PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(1, 1, __pyx_L1_error)
4891
if (!PyDict_GetItemString(modules, "code.alex.psage.psage.libs.smalljac.wrapper2")) {
4892
if (unlikely(PyDict_SetItemString(modules, "code.alex.psage.psage.libs.smalljac.wrapper2", __pyx_m) < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
4893
}
4894
}
4895
#endif
4896
/*--- Builtin init code ---*/
4897
if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4898
/*--- Constants init code ---*/
4899
if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4900
/*--- Global init code ---*/
4901
/*--- Variable export code ---*/
4902
/*--- Function export code ---*/
4903
/*--- Type init code ---*/
4904
__pyx_vtabptr_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac = &__pyx_vtable_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac;
4905
__pyx_vtable_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac.genus = (int (*)(struct __pyx_obj_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac *, int __pyx_skip_dispatch))__pyx_f_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_genus;
4906
if (PyType_Ready(&__pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
4907
__pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac.tp_print = 0;
4908
#if CYTHON_COMPILING_IN_CPYTHON
4909
{
4910
PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 3, __pyx_L1_error)
4911
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
4912
__pyx_wrapperbase_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_2__init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
4913
__pyx_wrapperbase_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_2__init__.doc = __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_2__init__;
4914
((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_2__init__;
4915
}
4916
}
4917
#endif
4918
#if CYTHON_COMPILING_IN_CPYTHON
4919
{
4920
PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac, "__repr__"); if (unlikely(!wrapper)) __PYX_ERR(0, 3, __pyx_L1_error)
4921
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
4922
__pyx_wrapperbase_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_4__repr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
4923
__pyx_wrapperbase_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_4__repr__.doc = __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_4__repr__;
4924
((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8SmallJac_4__repr__;
4925
}
4926
}
4927
#endif
4928
if (__Pyx_SetVtable(__pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac.tp_dict, __pyx_vtabptr_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
4929
if (PyObject_SetAttrString(__pyx_m, "SmallJac", (PyObject *)&__pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
4930
__pyx_ptype_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac = &__pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_SmallJac;
4931
if (PyType_Ready(&__pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_GroupModp) < 0) __PYX_ERR(1, 5, __pyx_L1_error)
4932
__pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_GroupModp.tp_print = 0;
4933
if (PyObject_SetAttrString(__pyx_m, "GroupModp", (PyObject *)&__pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_GroupModp) < 0) __PYX_ERR(1, 5, __pyx_L1_error)
4934
__pyx_ptype_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_GroupModp = &__pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_GroupModp;
4935
if (PyType_Ready(&__pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly) < 0) __PYX_ERR(1, 8, __pyx_L1_error)
4936
__pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly.tp_print = 0;
4937
#if CYTHON_COMPILING_IN_CPYTHON
4938
{
4939
PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(1, 8, __pyx_L1_error)
4940
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
4941
__pyx_wrapperbase_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
4942
__pyx_wrapperbase_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly___init__.doc = __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly___init__;
4943
((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly___init__;
4944
}
4945
}
4946
#endif
4947
#if CYTHON_COMPILING_IN_CPYTHON
4948
{
4949
PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly, "__repr__"); if (unlikely(!wrapper)) __PYX_ERR(1, 8, __pyx_L1_error)
4950
if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
4951
__pyx_wrapperbase_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_4__repr__ = *((PyWrapperDescrObject *)wrapper)->d_base;
4952
__pyx_wrapperbase_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_4__repr__.doc = __pyx_doc_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_4__repr__;
4953
((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_8FrobPoly_4__repr__;
4954
}
4955
}
4956
#endif
4957
if (PyObject_SetAttrString(__pyx_m, "FrobPoly", (PyObject *)&__pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly) < 0) __PYX_ERR(1, 8, __pyx_L1_error)
4958
__pyx_ptype_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly = &__pyx_type_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly;
4959
/*--- Type import code ---*/
4960
__pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
4961
#if CYTHON_COMPILING_IN_PYPY
4962
sizeof(PyTypeObject),
4963
#else
4964
sizeof(PyHeapTypeObject),
4965
#endif
4966
0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(4, 9, __pyx_L1_error)
4967
/*--- Variable import code ---*/
4968
__pyx_t_1 = __Pyx_ImportModule("cysignals.signals"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error)
4969
if (__Pyx_ImportVoidPtr(__pyx_t_1, "cysigs", (void **)&__pyx_vp_9cysignals_7signals_cysigs, "cysigs_t") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4970
Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4971
/*--- Function import code ---*/
4972
/*--- Execution code ---*/
4973
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
4974
if (__Pyx_patch_abc() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4975
#endif
4976
4977
/* "../../../../../../../sage/sage-7.5/local/lib/python2.7/site-packages/cysignals/signals.pxi":24
4978
* # This *must* be done for every module using interrupt functions
4979
* # otherwise you will get segmentation faults.
4980
* import_cysignals__signals() # <<<<<<<<<<<<<<
4981
*/
4982
__pyx_t_2 = import_cysignals__signals(); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(5, 24, __pyx_L1_error)
4983
4984
/* "../../../../../../../sage/sage-7.5/src/sage/ext/stdsage.pxi":24
4985
*
4986
* from sage.ext.stdsage cimport PY_NEW, HAS_DICTIONARY
4987
* from sage.ext.memory import init_memory_functions # <<<<<<<<<<<<<<
4988
*/
4989
__pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 24, __pyx_L1_error)
4990
__Pyx_GOTREF(__pyx_t_3);
4991
__Pyx_INCREF(__pyx_n_s_init_memory_functions);
4992
__Pyx_GIVEREF(__pyx_n_s_init_memory_functions);
4993
PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_init_memory_functions);
4994
__pyx_t_4 = __Pyx_Import(__pyx_n_s_sage_ext_memory, __pyx_t_3, -1); if (unlikely(!__pyx_t_4)) __PYX_ERR(6, 24, __pyx_L1_error)
4995
__Pyx_GOTREF(__pyx_t_4);
4996
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4997
__pyx_t_3 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_init_memory_functions); if (unlikely(!__pyx_t_3)) __PYX_ERR(6, 24, __pyx_L1_error)
4998
__Pyx_GOTREF(__pyx_t_3);
4999
if (PyDict_SetItem(__pyx_d, __pyx_n_s_init_memory_functions, __pyx_t_3) < 0) __PYX_ERR(6, 24, __pyx_L1_error)
5000
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5001
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5002
5003
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":33
5004
* return ZZ[var]([p*p, self.a0*p, self.a1, self.a0, 1])
5005
*
5006
* charpoly = characteristic_polynomial # <<<<<<<<<<<<<<
5007
*
5008
*
5009
*/
5010
__pyx_t_4 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly, __pyx_n_s_characteristic_polynomial); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 33, __pyx_L1_error)
5011
__Pyx_GOTREF(__pyx_t_4);
5012
if (PyDict_SetItem((PyObject *)__pyx_ptype_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly->tp_dict, __pyx_n_s_charpoly, __pyx_t_4) < 0) __PYX_ERR(1, 33, __pyx_L1_error)
5013
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5014
PyType_Modified(__pyx_ptype_4code_4alex_5psage_5psage_4libs_8smalljac_8wrapper2_FrobPoly);
5015
5016
/* "code/alex/psage/psage/libs/smalljac/wrapper2.pyx":1
5017
* include "wrapper0.pyx" # <<<<<<<<<<<<<<
5018
* include 'stdsage.pxi'
5019
*
5020
*/
5021
__pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1, __pyx_L1_error)
5022
__Pyx_GOTREF(__pyx_t_4);
5023
if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
5024
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5025
5026
/* "cysignals/signals.pxd":35
5027
* # (PyErr_Occurred() is non-NULL). To Cython, it will look like
5028
* # cython_check_exception() actually raised the exception.
5029
* cdef inline void cython_check_exception() nogil except *: # <<<<<<<<<<<<<<
5030
* pass
5031
*
5032
*/
5033
5034
/*--- Wrapped vars code ---*/
5035
5036
goto __pyx_L0;
5037
__pyx_L1_error:;
5038
__Pyx_XDECREF(__pyx_t_1);
5039
__Pyx_XDECREF(__pyx_t_3);
5040
__Pyx_XDECREF(__pyx_t_4);
5041
if (__pyx_m) {
5042
if (__pyx_d) {
5043
__Pyx_AddTraceback("init code.alex.psage.psage.libs.smalljac.wrapper2", __pyx_clineno, __pyx_lineno, __pyx_filename);
5044
}
5045
Py_DECREF(__pyx_m); __pyx_m = 0;
5046
} else if (!PyErr_Occurred()) {
5047
PyErr_SetString(PyExc_ImportError, "init code.alex.psage.psage.libs.smalljac.wrapper2");
5048
}
5049
__pyx_L0:;
5050
__Pyx_RefNannyFinishContext();
5051
#if PY_MAJOR_VERSION < 3
5052
return;
5053
#else
5054
return __pyx_m;
5055
#endif
5056
}
5057
5058
/* --- Runtime support code --- */
5059
/* Refnanny */
5060
#if CYTHON_REFNANNY
5061
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
5062
PyObject *m = NULL, *p = NULL;
5063
void *r = NULL;
5064
m = PyImport_ImportModule((char *)modname);
5065
if (!m) goto end;
5066
p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
5067
if (!p) goto end;
5068
r = PyLong_AsVoidPtr(p);
5069
end:
5070
Py_XDECREF(p);
5071
Py_XDECREF(m);
5072
return (__Pyx_RefNannyAPIStruct *)r;
5073
}
5074
#endif
5075
5076
/* GetBuiltinName */
5077
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
5078
PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
5079
if (unlikely(!result)) {
5080
PyErr_Format(PyExc_NameError,
5081
#if PY_MAJOR_VERSION >= 3
5082
"name '%U' is not defined", name);
5083
#else
5084
"name '%.200s' is not defined", PyString_AS_STRING(name));
5085
#endif
5086
}
5087
return result;
5088
}
5089
5090
/* RaiseArgTupleInvalid */
5091
static void __Pyx_RaiseArgtupleInvalid(
5092
const char* func_name,
5093
int exact,
5094
Py_ssize_t num_min,
5095
Py_ssize_t num_max,
5096
Py_ssize_t num_found)
5097
{
5098
Py_ssize_t num_expected;
5099
const char *more_or_less;
5100
if (num_found < num_min) {
5101
num_expected = num_min;
5102
more_or_less = "at least";
5103
} else {
5104
num_expected = num_max;
5105
more_or_less = "at most";
5106
}
5107
if (exact) {
5108
more_or_less = "exactly";
5109
}
5110
PyErr_Format(PyExc_TypeError,
5111
"%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
5112
func_name, more_or_less, num_expected,
5113
(num_expected == 1) ? "" : "s", num_found);
5114
}
5115
5116
/* KeywordStringCheck */
5117
static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
5118
PyObject *kwdict,
5119
const char* function_name,
5120
int kw_allowed)
5121
{
5122
PyObject* key = 0;
5123
Py_ssize_t pos = 0;
5124
#if CYTHON_COMPILING_IN_PYPY
5125
if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
5126
goto invalid_keyword;
5127
return 1;
5128
#else
5129
while (PyDict_Next(kwdict, &pos, &key, 0)) {
5130
#if PY_MAJOR_VERSION < 3
5131
if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
5132
#endif
5133
if (unlikely(!PyUnicode_Check(key)))
5134
goto invalid_keyword_type;
5135
}
5136
if ((!kw_allowed) && unlikely(key))
5137
goto invalid_keyword;
5138
return 1;
5139
invalid_keyword_type:
5140
PyErr_Format(PyExc_TypeError,
5141
"%.200s() keywords must be strings", function_name);
5142
return 0;
5143
#endif
5144
invalid_keyword:
5145
PyErr_Format(PyExc_TypeError,
5146
#if PY_MAJOR_VERSION < 3
5147
"%.200s() got an unexpected keyword argument '%.200s'",
5148
function_name, PyString_AsString(key));
5149
#else
5150
"%s() got an unexpected keyword argument '%U'",
5151
function_name, key);
5152
#endif
5153
return 0;
5154
}
5155
5156
/* RaiseDoubleKeywords */
5157
static void __Pyx_RaiseDoubleKeywordsError(
5158
const char* func_name,
5159
PyObject* kw_name)
5160
{
5161
PyErr_Format(PyExc_TypeError,
5162
#if PY_MAJOR_VERSION >= 3
5163
"%s() got multiple values for keyword argument '%U'", func_name, kw_name);
5164
#else
5165
"%s() got multiple values for keyword argument '%s'", func_name,
5166
PyString_AsString(kw_name));
5167
#endif
5168
}
5169
5170
/* ParseKeywords */
5171
static int __Pyx_ParseOptionalKeywords(
5172
PyObject *kwds,
5173
PyObject **argnames[],
5174
PyObject *kwds2,
5175
PyObject *values[],
5176
Py_ssize_t num_pos_args,
5177
const char* function_name)
5178
{
5179
PyObject *key = 0, *value = 0;
5180
Py_ssize_t pos = 0;
5181
PyObject*** name;
5182
PyObject*** first_kw_arg = argnames + num_pos_args;
5183
while (PyDict_Next(kwds, &pos, &key, &value)) {
5184
name = first_kw_arg;
5185
while (*name && (**name != key)) name++;
5186
if (*name) {
5187
values[name-argnames] = value;
5188
continue;
5189
}
5190
name = first_kw_arg;
5191
#if PY_MAJOR_VERSION < 3
5192
if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
5193
while (*name) {
5194
if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
5195
&& _PyString_Eq(**name, key)) {
5196
values[name-argnames] = value;
5197
break;
5198
}
5199
name++;
5200
}
5201
if (*name) continue;
5202
else {
5203
PyObject*** argname = argnames;
5204
while (argname != first_kw_arg) {
5205
if ((**argname == key) || (
5206
(CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
5207
&& _PyString_Eq(**argname, key))) {
5208
goto arg_passed_twice;
5209
}
5210
argname++;
5211
}
5212
}
5213
} else
5214
#endif
5215
if (likely(PyUnicode_Check(key))) {
5216
while (*name) {
5217
int cmp = (**name == key) ? 0 :
5218
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
5219
(PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
5220
#endif
5221
PyUnicode_Compare(**name, key);
5222
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
5223
if (cmp == 0) {
5224
values[name-argnames] = value;
5225
break;
5226
}
5227
name++;
5228
}
5229
if (*name) continue;
5230
else {
5231
PyObject*** argname = argnames;
5232
while (argname != first_kw_arg) {
5233
int cmp = (**argname == key) ? 0 :
5234
#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
5235
(PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
5236
#endif
5237
PyUnicode_Compare(**argname, key);
5238
if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
5239
if (cmp == 0) goto arg_passed_twice;
5240
argname++;
5241
}
5242
}
5243
} else
5244
goto invalid_keyword_type;
5245
if (kwds2) {
5246
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
5247
} else {
5248
goto invalid_keyword;
5249
}
5250
}
5251
return 0;
5252
arg_passed_twice:
5253
__Pyx_RaiseDoubleKeywordsError(function_name, key);
5254
goto bad;
5255
invalid_keyword_type:
5256
PyErr_Format(PyExc_TypeError,
5257
"%.200s() keywords must be strings", function_name);
5258
goto bad;
5259
invalid_keyword:
5260
PyErr_Format(PyExc_TypeError,
5261
#if PY_MAJOR_VERSION < 3
5262
"%.200s() got an unexpected keyword argument '%.200s'",
5263
function_name, PyString_AsString(key));
5264
#else
5265
"%s() got an unexpected keyword argument '%U'",
5266
function_name, key);
5267
#endif
5268
bad:
5269
return -1;
5270
}
5271
5272
/* PyObjectCall */
5273
#if CYTHON_COMPILING_IN_CPYTHON
5274
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
5275
PyObject *result;
5276
ternaryfunc call = func->ob_type->tp_call;
5277
if (unlikely(!call))
5278
return PyObject_Call(func, arg, kw);
5279
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
5280
return NULL;
5281
result = (*call)(func, arg, kw);
5282
Py_LeaveRecursiveCall();
5283
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
5284
PyErr_SetString(
5285
PyExc_SystemError,
5286
"NULL result without error in PyObject_Call");
5287
}
5288
return result;
5289
}
5290
#endif
5291
5292
/* PyErrFetchRestore */
5293
#if CYTHON_FAST_THREAD_STATE
5294
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
5295
PyObject *tmp_type, *tmp_value, *tmp_tb;
5296
tmp_type = tstate->curexc_type;
5297
tmp_value = tstate->curexc_value;
5298
tmp_tb = tstate->curexc_traceback;
5299
tstate->curexc_type = type;
5300
tstate->curexc_value = value;
5301
tstate->curexc_traceback = tb;
5302
Py_XDECREF(tmp_type);
5303
Py_XDECREF(tmp_value);
5304
Py_XDECREF(tmp_tb);
5305
}
5306
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
5307
*type = tstate->curexc_type;
5308
*value = tstate->curexc_value;
5309
*tb = tstate->curexc_traceback;
5310
tstate->curexc_type = 0;
5311
tstate->curexc_value = 0;
5312
tstate->curexc_traceback = 0;
5313
}
5314
#endif
5315
5316
/* RaiseException */
5317
#if PY_MAJOR_VERSION < 3
5318
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
5319
CYTHON_UNUSED PyObject *cause) {
5320
__Pyx_PyThreadState_declare
5321
Py_XINCREF(type);
5322
if (!value || value == Py_None)
5323
value = NULL;
5324
else
5325
Py_INCREF(value);
5326
if (!tb || tb == Py_None)
5327
tb = NULL;
5328
else {
5329
Py_INCREF(tb);
5330
if (!PyTraceBack_Check(tb)) {
5331
PyErr_SetString(PyExc_TypeError,
5332
"raise: arg 3 must be a traceback or None");
5333
goto raise_error;
5334
}
5335
}
5336
if (PyType_Check(type)) {
5337
#if CYTHON_COMPILING_IN_PYPY
5338
if (!value) {
5339
Py_INCREF(Py_None);
5340
value = Py_None;
5341
}
5342
#endif
5343
PyErr_NormalizeException(&type, &value, &tb);
5344
} else {
5345
if (value) {
5346
PyErr_SetString(PyExc_TypeError,
5347
"instance exception may not have a separate value");
5348
goto raise_error;
5349
}
5350
value = type;
5351
type = (PyObject*) Py_TYPE(type);
5352
Py_INCREF(type);
5353
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
5354
PyErr_SetString(PyExc_TypeError,
5355
"raise: exception class must be a subclass of BaseException");
5356
goto raise_error;
5357
}
5358
}
5359
__Pyx_PyThreadState_assign
5360
__Pyx_ErrRestore(type, value, tb);
5361
return;
5362
raise_error:
5363
Py_XDECREF(value);
5364
Py_XDECREF(type);
5365
Py_XDECREF(tb);
5366
return;
5367
}
5368
#else
5369
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
5370
PyObject* owned_instance = NULL;
5371
if (tb == Py_None) {
5372
tb = 0;
5373
} else if (tb && !PyTraceBack_Check(tb)) {
5374
PyErr_SetString(PyExc_TypeError,
5375
"raise: arg 3 must be a traceback or None");
5376
goto bad;
5377
}
5378
if (value == Py_None)
5379
value = 0;
5380
if (PyExceptionInstance_Check(type)) {
5381
if (value) {
5382
PyErr_SetString(PyExc_TypeError,
5383
"instance exception may not have a separate value");
5384
goto bad;
5385
}
5386
value = type;
5387
type = (PyObject*) Py_TYPE(value);
5388
} else if (PyExceptionClass_Check(type)) {
5389
PyObject *instance_class = NULL;
5390
if (value && PyExceptionInstance_Check(value)) {
5391
instance_class = (PyObject*) Py_TYPE(value);
5392
if (instance_class != type) {
5393
int is_subclass = PyObject_IsSubclass(instance_class, type);
5394
if (!is_subclass) {
5395
instance_class = NULL;
5396
} else if (unlikely(is_subclass == -1)) {
5397
goto bad;
5398
} else {
5399
type = instance_class;
5400
}
5401
}
5402
}
5403
if (!instance_class) {
5404
PyObject *args;
5405
if (!value)
5406
args = PyTuple_New(0);
5407
else if (PyTuple_Check(value)) {
5408
Py_INCREF(value);
5409
args = value;
5410
} else
5411
args = PyTuple_Pack(1, value);
5412
if (!args)
5413
goto bad;
5414
owned_instance = PyObject_Call(type, args, NULL);
5415
Py_DECREF(args);
5416
if (!owned_instance)
5417
goto bad;
5418
value = owned_instance;
5419
if (!PyExceptionInstance_Check(value)) {
5420
PyErr_Format(PyExc_TypeError,
5421
"calling %R should have returned an instance of "
5422
"BaseException, not %R",
5423
type, Py_TYPE(value));
5424
goto bad;
5425
}
5426
}
5427
} else {
5428
PyErr_SetString(PyExc_TypeError,
5429
"raise: exception class must be a subclass of BaseException");
5430
goto bad;
5431
}
5432
#if PY_VERSION_HEX >= 0x03030000
5433
if (cause) {
5434
#else
5435
if (cause && cause != Py_None) {
5436
#endif
5437
PyObject *fixed_cause;
5438
if (cause == Py_None) {
5439
fixed_cause = NULL;
5440
} else if (PyExceptionClass_Check(cause)) {
5441
fixed_cause = PyObject_CallObject(cause, NULL);
5442
if (fixed_cause == NULL)
5443
goto bad;
5444
} else if (PyExceptionInstance_Check(cause)) {
5445
fixed_cause = cause;
5446
Py_INCREF(fixed_cause);
5447
} else {
5448
PyErr_SetString(PyExc_TypeError,
5449
"exception causes must derive from "
5450
"BaseException");
5451
goto bad;
5452
}
5453
PyException_SetCause(value, fixed_cause);
5454
}
5455
PyErr_SetObject(type, value);
5456
if (tb) {
5457
#if CYTHON_COMPILING_IN_PYPY
5458
PyObject *tmp_type, *tmp_value, *tmp_tb;
5459
PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
5460
Py_INCREF(tb);
5461
PyErr_Restore(tmp_type, tmp_value, tb);
5462
Py_XDECREF(tmp_tb);
5463
#else
5464
PyThreadState *tstate = PyThreadState_GET();
5465
PyObject* tmp_tb = tstate->curexc_traceback;
5466
if (tb != tmp_tb) {
5467
Py_INCREF(tb);
5468
tstate->curexc_traceback = tb;
5469
Py_XDECREF(tmp_tb);
5470
}
5471
#endif
5472
}
5473
bad:
5474
Py_XDECREF(owned_instance);
5475
return;
5476
}
5477
#endif
5478
5479
/* PyCFunctionFastCall */
5480
#if CYTHON_FAST_PYCCALL
5481
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
5482
PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
5483
PyCFunction meth = PyCFunction_GET_FUNCTION(func);
5484
PyObject *self = PyCFunction_GET_SELF(func);
5485
assert(PyCFunction_Check(func));
5486
assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)));
5487
assert(nargs >= 0);
5488
assert(nargs == 0 || args != NULL);
5489
/* _PyCFunction_FastCallDict() must not be called with an exception set,
5490
because it may clear it (directly or indirectly) and so the
5491
caller loses its exception */
5492
assert(!PyErr_Occurred());
5493
return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
5494
}
5495
#endif // CYTHON_FAST_PYCCALL
5496
5497
/* PyFunctionFastCall */
5498
#if CYTHON_FAST_PYCALL
5499
#include "frameobject.h"
5500
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
5501
PyObject *globals) {
5502
PyFrameObject *f;
5503
PyThreadState *tstate = PyThreadState_GET();
5504
PyObject **fastlocals;
5505
Py_ssize_t i;
5506
PyObject *result;
5507
assert(globals != NULL);
5508
/* XXX Perhaps we should create a specialized
5509
PyFrame_New() that doesn't take locals, but does
5510
take builtins without sanity checking them.
5511
*/
5512
assert(tstate != NULL);
5513
f = PyFrame_New(tstate, co, globals, NULL);
5514
if (f == NULL) {
5515
return NULL;
5516
}
5517
fastlocals = f->f_localsplus;
5518
for (i = 0; i < na; i++) {
5519
Py_INCREF(*args);
5520
fastlocals[i] = *args++;
5521
}
5522
result = PyEval_EvalFrameEx(f,0);
5523
++tstate->recursion_depth;
5524
Py_DECREF(f);
5525
--tstate->recursion_depth;
5526
return result;
5527
}
5528
#if 1 || PY_VERSION_HEX < 0x030600B1
5529
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
5530
PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
5531
PyObject *globals = PyFunction_GET_GLOBALS(func);
5532
PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
5533
PyObject *closure;
5534
#if PY_MAJOR_VERSION >= 3
5535
PyObject *kwdefs;
5536
#endif
5537
PyObject *kwtuple, **k;
5538
PyObject **d;
5539
Py_ssize_t nd;
5540
Py_ssize_t nk;
5541
PyObject *result;
5542
assert(kwargs == NULL || PyDict_Check(kwargs));
5543
nk = kwargs ? PyDict_Size(kwargs) : 0;
5544
if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
5545
return NULL;
5546
}
5547
if (
5548
#if PY_MAJOR_VERSION >= 3
5549
co->co_kwonlyargcount == 0 &&
5550
#endif
5551
likely(kwargs == NULL || nk == 0) &&
5552
co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
5553
if (argdefs == NULL && co->co_argcount == nargs) {
5554
result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
5555
goto done;
5556
}
5557
else if (nargs == 0 && argdefs != NULL
5558
&& co->co_argcount == Py_SIZE(argdefs)) {
5559
/* function called with no arguments, but all parameters have
5560
a default value: use default values as arguments .*/
5561
args = &PyTuple_GET_ITEM(argdefs, 0);
5562
result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
5563
goto done;
5564
}
5565
}
5566
if (kwargs != NULL) {
5567
Py_ssize_t pos, i;
5568
kwtuple = PyTuple_New(2 * nk);
5569
if (kwtuple == NULL) {
5570
result = NULL;
5571
goto done;
5572
}
5573
k = &PyTuple_GET_ITEM(kwtuple, 0);
5574
pos = i = 0;
5575
while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
5576
Py_INCREF(k[i]);
5577
Py_INCREF(k[i+1]);
5578
i += 2;
5579
}
5580
nk = i / 2;
5581
}
5582
else {
5583
kwtuple = NULL;
5584
k = NULL;
5585
}
5586
closure = PyFunction_GET_CLOSURE(func);
5587
#if PY_MAJOR_VERSION >= 3
5588
kwdefs = PyFunction_GET_KW_DEFAULTS(func);
5589
#endif
5590
if (argdefs != NULL) {
5591
d = &PyTuple_GET_ITEM(argdefs, 0);
5592
nd = Py_SIZE(argdefs);
5593
}
5594
else {
5595
d = NULL;
5596
nd = 0;
5597
}
5598
#if PY_MAJOR_VERSION >= 3
5599
result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
5600
args, nargs,
5601
k, (int)nk,
5602
d, (int)nd, kwdefs, closure);
5603
#else
5604
result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
5605
args, nargs,
5606
k, (int)nk,
5607
d, (int)nd, closure);
5608
#endif
5609
Py_XDECREF(kwtuple);
5610
done:
5611
Py_LeaveRecursiveCall();
5612
return result;
5613
}
5614
#endif // CPython < 3.6
5615
#endif // CYTHON_FAST_PYCALL
5616
5617
/* PyObjectCallMethO */
5618
#if CYTHON_COMPILING_IN_CPYTHON
5619
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
5620
PyObject *self, *result;
5621
PyCFunction cfunc;
5622
cfunc = PyCFunction_GET_FUNCTION(func);
5623
self = PyCFunction_GET_SELF(func);
5624
if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
5625
return NULL;
5626
result = cfunc(self, arg);
5627
Py_LeaveRecursiveCall();
5628
if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
5629
PyErr_SetString(
5630
PyExc_SystemError,
5631
"NULL result without error in PyObject_Call");
5632
}
5633
return result;
5634
}
5635
#endif
5636
5637
/* PyObjectCallOneArg */
5638
#if CYTHON_COMPILING_IN_CPYTHON
5639
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
5640
PyObject *result;
5641
PyObject *args = PyTuple_New(1);
5642
if (unlikely(!args)) return NULL;
5643
Py_INCREF(arg);
5644
PyTuple_SET_ITEM(args, 0, arg);
5645
result = __Pyx_PyObject_Call(func, args, NULL);
5646
Py_DECREF(args);
5647
return result;
5648
}
5649
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
5650
#if CYTHON_FAST_PYCALL
5651
if (PyFunction_Check(func)) {
5652
return __Pyx_PyFunction_FastCall(func, &arg, 1);
5653
}
5654
#endif
5655
#ifdef __Pyx_CyFunction_USED
5656
if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
5657
#else
5658
if (likely(PyCFunction_Check(func))) {
5659
#endif
5660
if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
5661
return __Pyx_PyObject_CallMethO(func, arg);
5662
#if CYTHON_FAST_PYCCALL
5663
} else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
5664
return __Pyx_PyCFunction_FastCall(func, &arg, 1);
5665
#endif
5666
}
5667
}
5668
return __Pyx__PyObject_CallOneArg(func, arg);
5669
}
5670
#else
5671
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
5672
PyObject *result;
5673
PyObject *args = PyTuple_Pack(1, arg);
5674
if (unlikely(!args)) return NULL;
5675
result = __Pyx_PyObject_Call(func, args, NULL);
5676
Py_DECREF(args);
5677
return result;
5678
}
5679
#endif
5680
5681
/* PyObjectCallNoArg */
5682
#if CYTHON_COMPILING_IN_CPYTHON
5683
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
5684
#if CYTHON_FAST_PYCALL
5685
if (PyFunction_Check(func)) {
5686
return __Pyx_PyFunction_FastCall(func, NULL, 0);
5687
}
5688
#endif
5689
#ifdef __Pyx_CyFunction_USED
5690
if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
5691
#else
5692
if (likely(PyCFunction_Check(func))) {
5693
#endif
5694
if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
5695
return __Pyx_PyObject_CallMethO(func, NULL);
5696
}
5697
}
5698
return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
5699
}
5700
#endif
5701
5702
/* WriteUnraisableException */
5703
static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
5704
CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
5705
int full_traceback, CYTHON_UNUSED int nogil) {
5706
PyObject *old_exc, *old_val, *old_tb;
5707
PyObject *ctx;
5708
__Pyx_PyThreadState_declare
5709
#ifdef WITH_THREAD
5710
PyGILState_STATE state;
5711
if (nogil)
5712
state = PyGILState_Ensure();
5713
#ifdef _MSC_VER
5714
else state = (PyGILState_STATE)-1;
5715
#endif
5716
#endif
5717
__Pyx_PyThreadState_assign
5718
__Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
5719
if (full_traceback) {
5720
Py_XINCREF(old_exc);
5721
Py_XINCREF(old_val);
5722
Py_XINCREF(old_tb);
5723
__Pyx_ErrRestore(old_exc, old_val, old_tb);
5724
PyErr_PrintEx(1);
5725
}
5726
#if PY_MAJOR_VERSION < 3
5727
ctx = PyString_FromString(name);
5728
#else
5729
ctx = PyUnicode_FromString(name);
5730
#endif
5731
__Pyx_ErrRestore(old_exc, old_val, old_tb);
5732
if (!ctx) {
5733
PyErr_WriteUnraisable(Py_None);
5734
} else {
5735
PyErr_WriteUnraisable(ctx);
5736
Py_DECREF(ctx);
5737
}
5738
#ifdef WITH_THREAD
5739
if (nogil)
5740
PyGILState_Release(state);
5741
#endif
5742
}
5743
5744
/* GetModuleGlobalName */
5745
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
5746
PyObject *result;
5747
#if !CYTHON_AVOID_BORROWED_REFS
5748
result = PyDict_GetItem(__pyx_d, name);
5749
if (likely(result)) {
5750
Py_INCREF(result);
5751
} else {
5752
#else
5753
result = PyObject_GetItem(__pyx_d, name);
5754
if (!result) {
5755
PyErr_Clear();
5756
#endif
5757
result = __Pyx_GetBuiltinName(name);
5758
}
5759
return result;
5760
}
5761
5762
/* Import */
5763
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
5764
PyObject *empty_list = 0;
5765
PyObject *module = 0;
5766
PyObject *global_dict = 0;
5767
PyObject *empty_dict = 0;
5768
PyObject *list;
5769
#if PY_VERSION_HEX < 0x03030000
5770
PyObject *py_import;
5771
py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
5772
if (!py_import)
5773
goto bad;
5774
#endif
5775
if (from_list)
5776
list = from_list;
5777
else {
5778
empty_list = PyList_New(0);
5779
if (!empty_list)
5780
goto bad;
5781
list = empty_list;
5782
}
5783
global_dict = PyModule_GetDict(__pyx_m);
5784
if (!global_dict)
5785
goto bad;
5786
empty_dict = PyDict_New();
5787
if (!empty_dict)
5788
goto bad;
5789
{
5790
#if PY_MAJOR_VERSION >= 3
5791
if (level == -1) {
5792
if (strchr(__Pyx_MODULE_NAME, '.')) {
5793
#if PY_VERSION_HEX < 0x03030000
5794
PyObject *py_level = PyInt_FromLong(1);
5795
if (!py_level)
5796
goto bad;
5797
module = PyObject_CallFunctionObjArgs(py_import,
5798
name, global_dict, empty_dict, list, py_level, NULL);
5799
Py_DECREF(py_level);
5800
#else
5801
module = PyImport_ImportModuleLevelObject(
5802
name, global_dict, empty_dict, list, 1);
5803
#endif
5804
if (!module) {
5805
if (!PyErr_ExceptionMatches(PyExc_ImportError))
5806
goto bad;
5807
PyErr_Clear();
5808
}
5809
}
5810
level = 0;
5811
}
5812
#endif
5813
if (!module) {
5814
#if PY_VERSION_HEX < 0x03030000
5815
PyObject *py_level = PyInt_FromLong(level);
5816
if (!py_level)
5817
goto bad;
5818
module = PyObject_CallFunctionObjArgs(py_import,
5819
name, global_dict, empty_dict, list, py_level, NULL);
5820
Py_DECREF(py_level);
5821
#else
5822
module = PyImport_ImportModuleLevelObject(
5823
name, global_dict, empty_dict, list, level);
5824
#endif
5825
}
5826
}
5827
bad:
5828
#if PY_VERSION_HEX < 0x03030000
5829
Py_XDECREF(py_import);
5830
#endif
5831
Py_XDECREF(empty_list);
5832
Py_XDECREF(empty_dict);
5833
return module;
5834
}
5835
5836
/* ImportFrom */
5837
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
5838
PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
5839
if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
5840
PyErr_Format(PyExc_ImportError,
5841
#if PY_MAJOR_VERSION < 3
5842
"cannot import name %.230s", PyString_AS_STRING(name));
5843
#else
5844
"cannot import name %S", name);
5845
#endif
5846
}
5847
return value;
5848
}
5849
5850
/* ExtTypeTest */
5851
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
5852
if (unlikely(!type)) {
5853
PyErr_SetString(PyExc_SystemError, "Missing type object");
5854
return 0;
5855
}
5856
if (likely(PyObject_TypeCheck(obj, type)))
5857
return 1;
5858
PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
5859
Py_TYPE(obj)->tp_name, type->tp_name);
5860
return 0;
5861
}
5862
5863
/* SetVTable */
5864
static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
5865
#if PY_VERSION_HEX >= 0x02070000
5866
PyObject *ob = PyCapsule_New(vtable, 0, 0);
5867
#else
5868
PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
5869
#endif
5870
if (!ob)
5871
goto bad;
5872
if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
5873
goto bad;
5874
Py_DECREF(ob);
5875
return 0;
5876
bad:
5877
Py_XDECREF(ob);
5878
return -1;
5879
}
5880
5881
/* GetNameInClass */
5882
static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) {
5883
PyObject *result;
5884
result = __Pyx_PyObject_GetAttrStr(nmspace, name);
5885
if (!result)
5886
result = __Pyx_GetModuleGlobalName(name);
5887
return result;
5888
}
5889
5890
/* CodeObjectCache */
5891
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
5892
int start = 0, mid = 0, end = count - 1;
5893
if (end >= 0 && code_line > entries[end].code_line) {
5894
return count;
5895
}
5896
while (start < end) {
5897
mid = start + (end - start) / 2;
5898
if (code_line < entries[mid].code_line) {
5899
end = mid;
5900
} else if (code_line > entries[mid].code_line) {
5901
start = mid + 1;
5902
} else {
5903
return mid;
5904
}
5905
}
5906
if (code_line <= entries[mid].code_line) {
5907
return mid;
5908
} else {
5909
return mid + 1;
5910
}
5911
}
5912
static PyCodeObject *__pyx_find_code_object(int code_line) {
5913
PyCodeObject* code_object;
5914
int pos;
5915
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
5916
return NULL;
5917
}
5918
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
5919
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
5920
return NULL;
5921
}
5922
code_object = __pyx_code_cache.entries[pos].code_object;
5923
Py_INCREF(code_object);
5924
return code_object;
5925
}
5926
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
5927
int pos, i;
5928
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
5929
if (unlikely(!code_line)) {
5930
return;
5931
}
5932
if (unlikely(!entries)) {
5933
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
5934
if (likely(entries)) {
5935
__pyx_code_cache.entries = entries;
5936
__pyx_code_cache.max_count = 64;
5937
__pyx_code_cache.count = 1;
5938
entries[0].code_line = code_line;
5939
entries[0].code_object = code_object;
5940
Py_INCREF(code_object);
5941
}
5942
return;
5943
}
5944
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
5945
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
5946
PyCodeObject* tmp = entries[pos].code_object;
5947
entries[pos].code_object = code_object;
5948
Py_DECREF(tmp);
5949
return;
5950
}
5951
if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
5952
int new_max = __pyx_code_cache.max_count + 64;
5953
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
5954
__pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
5955
if (unlikely(!entries)) {
5956
return;
5957
}
5958
__pyx_code_cache.entries = entries;
5959
__pyx_code_cache.max_count = new_max;
5960
}
5961
for (i=__pyx_code_cache.count; i>pos; i--) {
5962
entries[i] = entries[i-1];
5963
}
5964
entries[pos].code_line = code_line;
5965
entries[pos].code_object = code_object;
5966
__pyx_code_cache.count++;
5967
Py_INCREF(code_object);
5968
}
5969
5970
/* AddTraceback */
5971
#include "compile.h"
5972
#include "frameobject.h"
5973
#include "traceback.h"
5974
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
5975
const char *funcname, int c_line,
5976
int py_line, const char *filename) {
5977
PyCodeObject *py_code = 0;
5978
PyObject *py_srcfile = 0;
5979
PyObject *py_funcname = 0;
5980
#if PY_MAJOR_VERSION < 3
5981
py_srcfile = PyString_FromString(filename);
5982
#else
5983
py_srcfile = PyUnicode_FromString(filename);
5984
#endif
5985
if (!py_srcfile) goto bad;
5986
if (c_line) {
5987
#if PY_MAJOR_VERSION < 3
5988
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
5989
#else
5990
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
5991
#endif
5992
}
5993
else {
5994
#if PY_MAJOR_VERSION < 3
5995
py_funcname = PyString_FromString(funcname);
5996
#else
5997
py_funcname = PyUnicode_FromString(funcname);
5998
#endif
5999
}
6000
if (!py_funcname) goto bad;
6001
py_code = __Pyx_PyCode_New(
6002
0,
6003
0,
6004
0,
6005
0,
6006
0,
6007
__pyx_empty_bytes, /*PyObject *code,*/
6008
__pyx_empty_tuple, /*PyObject *consts,*/
6009
__pyx_empty_tuple, /*PyObject *names,*/
6010
__pyx_empty_tuple, /*PyObject *varnames,*/
6011
__pyx_empty_tuple, /*PyObject *freevars,*/
6012
__pyx_empty_tuple, /*PyObject *cellvars,*/
6013
py_srcfile, /*PyObject *filename,*/
6014
py_funcname, /*PyObject *name,*/
6015
py_line,
6016
__pyx_empty_bytes /*PyObject *lnotab*/
6017
);
6018
Py_DECREF(py_srcfile);
6019
Py_DECREF(py_funcname);
6020
return py_code;
6021
bad:
6022
Py_XDECREF(py_srcfile);
6023
Py_XDECREF(py_funcname);
6024
return NULL;
6025
}
6026
static void __Pyx_AddTraceback(const char *funcname, int c_line,
6027
int py_line, const char *filename) {
6028
PyCodeObject *py_code = 0;
6029
PyFrameObject *py_frame = 0;
6030
py_code = __pyx_find_code_object(c_line ? c_line : py_line);
6031
if (!py_code) {
6032
py_code = __Pyx_CreateCodeObjectForTraceback(
6033
funcname, c_line, py_line, filename);
6034
if (!py_code) goto bad;
6035
__pyx_insert_code_object(c_line ? c_line : py_line, py_code);
6036
}
6037
py_frame = PyFrame_New(
6038
PyThreadState_GET(), /*PyThreadState *tstate,*/
6039
py_code, /*PyCodeObject *code,*/
6040
__pyx_d, /*PyObject *globals,*/
6041
0 /*PyObject *locals*/
6042
);
6043
if (!py_frame) goto bad;
6044
__Pyx_PyFrame_SetLineNumber(py_frame, py_line);
6045
PyTraceBack_Here(py_frame);
6046
bad:
6047
Py_XDECREF(py_code);
6048
Py_XDECREF(py_frame);
6049
}
6050
6051
/* CIntFromPyVerify */
6052
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
6053
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
6054
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
6055
__PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
6056
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
6057
{\
6058
func_type value = func_value;\
6059
if (sizeof(target_type) < sizeof(func_type)) {\
6060
if (unlikely(value != (func_type) (target_type) value)) {\
6061
func_type zero = 0;\
6062
if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
6063
return (target_type) -1;\
6064
if (is_unsigned && unlikely(value < zero))\
6065
goto raise_neg_overflow;\
6066
else\
6067
goto raise_overflow;\
6068
}\
6069
}\
6070
return (target_type) value;\
6071
}
6072
6073
/* CIntToPy */
6074
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
6075
const int neg_one = (int) -1, const_zero = (int) 0;
6076
const int is_unsigned = neg_one > const_zero;
6077
if (is_unsigned) {
6078
if (sizeof(int) < sizeof(long)) {
6079
return PyInt_FromLong((long) value);
6080
} else if (sizeof(int) <= sizeof(unsigned long)) {
6081
return PyLong_FromUnsignedLong((unsigned long) value);
6082
#ifdef HAVE_LONG_LONG
6083
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
6084
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
6085
#endif
6086
}
6087
} else {
6088
if (sizeof(int) <= sizeof(long)) {
6089
return PyInt_FromLong((long) value);
6090
#ifdef HAVE_LONG_LONG
6091
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
6092
return PyLong_FromLongLong((PY_LONG_LONG) value);
6093
#endif
6094
}
6095
}
6096
{
6097
int one = 1; int little = (int)*(unsigned char *)&one;
6098
unsigned char *bytes = (unsigned char *)&value;
6099
return _PyLong_FromByteArray(bytes, sizeof(int),
6100
little, !is_unsigned);
6101
}
6102
}
6103
6104
/* CIntToPy */
6105
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
6106
const long neg_one = (long) -1, const_zero = (long) 0;
6107
const int is_unsigned = neg_one > const_zero;
6108
if (is_unsigned) {
6109
if (sizeof(long) < sizeof(long)) {
6110
return PyInt_FromLong((long) value);
6111
} else if (sizeof(long) <= sizeof(unsigned long)) {
6112
return PyLong_FromUnsignedLong((unsigned long) value);
6113
#ifdef HAVE_LONG_LONG
6114
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
6115
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
6116
#endif
6117
}
6118
} else {
6119
if (sizeof(long) <= sizeof(long)) {
6120
return PyInt_FromLong((long) value);
6121
#ifdef HAVE_LONG_LONG
6122
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
6123
return PyLong_FromLongLong((PY_LONG_LONG) value);
6124
#endif
6125
}
6126
}
6127
{
6128
int one = 1; int little = (int)*(unsigned char *)&one;
6129
unsigned char *bytes = (unsigned char *)&value;
6130
return _PyLong_FromByteArray(bytes, sizeof(long),
6131
little, !is_unsigned);
6132
}
6133
}
6134
6135
/* CIntToPy */
6136
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_long(unsigned long value) {
6137
const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned long) 0;
6138
const int is_unsigned = neg_one > const_zero;
6139
if (is_unsigned) {
6140
if (sizeof(unsigned long) < sizeof(long)) {
6141
return PyInt_FromLong((long) value);
6142
} else if (sizeof(unsigned long) <= sizeof(unsigned long)) {
6143
return PyLong_FromUnsignedLong((unsigned long) value);
6144
#ifdef HAVE_LONG_LONG
6145
} else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) {
6146
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
6147
#endif
6148
}
6149
} else {
6150
if (sizeof(unsigned long) <= sizeof(long)) {
6151
return PyInt_FromLong((long) value);
6152
#ifdef HAVE_LONG_LONG
6153
} else if (sizeof(unsigned long) <= sizeof(PY_LONG_LONG)) {
6154
return PyLong_FromLongLong((PY_LONG_LONG) value);
6155
#endif
6156
}
6157
}
6158
{
6159
int one = 1; int little = (int)*(unsigned char *)&one;
6160
unsigned char *bytes = (unsigned char *)&value;
6161
return _PyLong_FromByteArray(bytes, sizeof(unsigned long),
6162
little, !is_unsigned);
6163
}
6164
}
6165
6166
/* CIntFromPy */
6167
static CYTHON_INLINE unsigned long __Pyx_PyInt_As_unsigned_long(PyObject *x) {
6168
const unsigned long neg_one = (unsigned long) -1, const_zero = (unsigned long) 0;
6169
const int is_unsigned = neg_one > const_zero;
6170
#if PY_MAJOR_VERSION < 3
6171
if (likely(PyInt_Check(x))) {
6172
if (sizeof(unsigned long) < sizeof(long)) {
6173
__PYX_VERIFY_RETURN_INT(unsigned long, long, PyInt_AS_LONG(x))
6174
} else {
6175
long val = PyInt_AS_LONG(x);
6176
if (is_unsigned && unlikely(val < 0)) {
6177
goto raise_neg_overflow;
6178
}
6179
return (unsigned long) val;
6180
}
6181
} else
6182
#endif
6183
if (likely(PyLong_Check(x))) {
6184
if (is_unsigned) {
6185
#if CYTHON_USE_PYLONG_INTERNALS
6186
const digit* digits = ((PyLongObject*)x)->ob_digit;
6187
switch (Py_SIZE(x)) {
6188
case 0: return (unsigned long) 0;
6189
case 1: __PYX_VERIFY_RETURN_INT(unsigned long, digit, digits[0])
6190
case 2:
6191
if (8 * sizeof(unsigned long) > 1 * PyLong_SHIFT) {
6192
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6193
__PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6194
} else if (8 * sizeof(unsigned long) >= 2 * PyLong_SHIFT) {
6195
return (unsigned long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
6196
}
6197
}
6198
break;
6199
case 3:
6200
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6201
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6202
__PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6203
} else if (8 * sizeof(unsigned long) >= 3 * PyLong_SHIFT) {
6204
return (unsigned long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
6205
}
6206
}
6207
break;
6208
case 4:
6209
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6210
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6211
__PYX_VERIFY_RETURN_INT(unsigned 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])))
6212
} else if (8 * sizeof(unsigned long) >= 4 * PyLong_SHIFT) {
6213
return (unsigned long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
6214
}
6215
}
6216
break;
6217
}
6218
#endif
6219
#if CYTHON_COMPILING_IN_CPYTHON
6220
if (unlikely(Py_SIZE(x) < 0)) {
6221
goto raise_neg_overflow;
6222
}
6223
#else
6224
{
6225
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
6226
if (unlikely(result < 0))
6227
return (unsigned long) -1;
6228
if (unlikely(result == 1))
6229
goto raise_neg_overflow;
6230
}
6231
#endif
6232
if (sizeof(unsigned long) <= sizeof(unsigned long)) {
6233
__PYX_VERIFY_RETURN_INT_EXC(unsigned long, unsigned long, PyLong_AsUnsignedLong(x))
6234
#ifdef HAVE_LONG_LONG
6235
} else if (sizeof(unsigned long) <= sizeof(unsigned PY_LONG_LONG)) {
6236
__PYX_VERIFY_RETURN_INT_EXC(unsigned long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
6237
#endif
6238
}
6239
} else {
6240
#if CYTHON_USE_PYLONG_INTERNALS
6241
const digit* digits = ((PyLongObject*)x)->ob_digit;
6242
switch (Py_SIZE(x)) {
6243
case 0: return (unsigned long) 0;
6244
case -1: __PYX_VERIFY_RETURN_INT(unsigned long, sdigit, (sdigit) (-(sdigit)digits[0]))
6245
case 1: __PYX_VERIFY_RETURN_INT(unsigned long, digit, +digits[0])
6246
case -2:
6247
if (8 * sizeof(unsigned long) - 1 > 1 * PyLong_SHIFT) {
6248
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6249
__PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6250
} else if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) {
6251
return (unsigned long) (((unsigned long)-1)*(((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
6252
}
6253
}
6254
break;
6255
case 2:
6256
if (8 * sizeof(unsigned long) > 1 * PyLong_SHIFT) {
6257
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6258
__PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6259
} else if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) {
6260
return (unsigned long) ((((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
6261
}
6262
}
6263
break;
6264
case -3:
6265
if (8 * sizeof(unsigned long) - 1 > 2 * PyLong_SHIFT) {
6266
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6267
__PYX_VERIFY_RETURN_INT(unsigned long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6268
} else if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) {
6269
return (unsigned long) (((unsigned long)-1)*(((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
6270
}
6271
}
6272
break;
6273
case 3:
6274
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6275
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6276
__PYX_VERIFY_RETURN_INT(unsigned long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6277
} else if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) {
6278
return (unsigned long) ((((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
6279
}
6280
}
6281
break;
6282
case -4:
6283
if (8 * sizeof(unsigned long) - 1 > 3 * PyLong_SHIFT) {
6284
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6285
__PYX_VERIFY_RETURN_INT(unsigned 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])))
6286
} else if (8 * sizeof(unsigned long) - 1 > 4 * PyLong_SHIFT) {
6287
return (unsigned long) (((unsigned long)-1)*(((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
6288
}
6289
}
6290
break;
6291
case 4:
6292
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6293
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6294
__PYX_VERIFY_RETURN_INT(unsigned 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])))
6295
} else if (8 * sizeof(unsigned long) - 1 > 4 * PyLong_SHIFT) {
6296
return (unsigned long) ((((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])));
6297
}
6298
}
6299
break;
6300
}
6301
#endif
6302
if (sizeof(unsigned long) <= sizeof(long)) {
6303
__PYX_VERIFY_RETURN_INT_EXC(unsigned long, long, PyLong_AsLong(x))
6304
#ifdef HAVE_LONG_LONG
6305
} else if (sizeof(unsigned long) <= sizeof(PY_LONG_LONG)) {
6306
__PYX_VERIFY_RETURN_INT_EXC(unsigned long, PY_LONG_LONG, PyLong_AsLongLong(x))
6307
#endif
6308
}
6309
}
6310
{
6311
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
6312
PyErr_SetString(PyExc_RuntimeError,
6313
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
6314
#else
6315
unsigned long val;
6316
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
6317
#if PY_MAJOR_VERSION < 3
6318
if (likely(v) && !PyLong_Check(v)) {
6319
PyObject *tmp = v;
6320
v = PyNumber_Long(tmp);
6321
Py_DECREF(tmp);
6322
}
6323
#endif
6324
if (likely(v)) {
6325
int one = 1; int is_little = (int)*(unsigned char *)&one;
6326
unsigned char *bytes = (unsigned char *)&val;
6327
int ret = _PyLong_AsByteArray((PyLongObject *)v,
6328
bytes, sizeof(val),
6329
is_little, !is_unsigned);
6330
Py_DECREF(v);
6331
if (likely(!ret))
6332
return val;
6333
}
6334
#endif
6335
return (unsigned long) -1;
6336
}
6337
} else {
6338
unsigned long val;
6339
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
6340
if (!tmp) return (unsigned long) -1;
6341
val = __Pyx_PyInt_As_unsigned_long(tmp);
6342
Py_DECREF(tmp);
6343
return val;
6344
}
6345
raise_overflow:
6346
PyErr_SetString(PyExc_OverflowError,
6347
"value too large to convert to unsigned long");
6348
return (unsigned long) -1;
6349
raise_neg_overflow:
6350
PyErr_SetString(PyExc_OverflowError,
6351
"can't convert negative value to unsigned long");
6352
return (unsigned long) -1;
6353
}
6354
6355
/* CIntFromPy */
6356
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
6357
const long neg_one = (long) -1, const_zero = (long) 0;
6358
const int is_unsigned = neg_one > const_zero;
6359
#if PY_MAJOR_VERSION < 3
6360
if (likely(PyInt_Check(x))) {
6361
if (sizeof(long) < sizeof(long)) {
6362
__PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
6363
} else {
6364
long val = PyInt_AS_LONG(x);
6365
if (is_unsigned && unlikely(val < 0)) {
6366
goto raise_neg_overflow;
6367
}
6368
return (long) val;
6369
}
6370
} else
6371
#endif
6372
if (likely(PyLong_Check(x))) {
6373
if (is_unsigned) {
6374
#if CYTHON_USE_PYLONG_INTERNALS
6375
const digit* digits = ((PyLongObject*)x)->ob_digit;
6376
switch (Py_SIZE(x)) {
6377
case 0: return (long) 0;
6378
case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
6379
case 2:
6380
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
6381
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6382
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6383
} else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
6384
return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
6385
}
6386
}
6387
break;
6388
case 3:
6389
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
6390
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6391
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6392
} else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
6393
return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
6394
}
6395
}
6396
break;
6397
case 4:
6398
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
6399
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6400
__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])))
6401
} else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
6402
return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
6403
}
6404
}
6405
break;
6406
}
6407
#endif
6408
#if CYTHON_COMPILING_IN_CPYTHON
6409
if (unlikely(Py_SIZE(x) < 0)) {
6410
goto raise_neg_overflow;
6411
}
6412
#else
6413
{
6414
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
6415
if (unlikely(result < 0))
6416
return (long) -1;
6417
if (unlikely(result == 1))
6418
goto raise_neg_overflow;
6419
}
6420
#endif
6421
if (sizeof(long) <= sizeof(unsigned long)) {
6422
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
6423
#ifdef HAVE_LONG_LONG
6424
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
6425
__PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
6426
#endif
6427
}
6428
} else {
6429
#if CYTHON_USE_PYLONG_INTERNALS
6430
const digit* digits = ((PyLongObject*)x)->ob_digit;
6431
switch (Py_SIZE(x)) {
6432
case 0: return (long) 0;
6433
case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
6434
case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
6435
case -2:
6436
if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
6437
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6438
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6439
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
6440
return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6441
}
6442
}
6443
break;
6444
case 2:
6445
if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
6446
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6447
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6448
} else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
6449
return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6450
}
6451
}
6452
break;
6453
case -3:
6454
if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
6455
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6456
__PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6457
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
6458
return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6459
}
6460
}
6461
break;
6462
case 3:
6463
if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
6464
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6465
__PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6466
} else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
6467
return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6468
}
6469
}
6470
break;
6471
case -4:
6472
if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
6473
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6474
__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])))
6475
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
6476
return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6477
}
6478
}
6479
break;
6480
case 4:
6481
if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
6482
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6483
__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])))
6484
} else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
6485
return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6486
}
6487
}
6488
break;
6489
}
6490
#endif
6491
if (sizeof(long) <= sizeof(long)) {
6492
__PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
6493
#ifdef HAVE_LONG_LONG
6494
} else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
6495
__PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
6496
#endif
6497
}
6498
}
6499
{
6500
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
6501
PyErr_SetString(PyExc_RuntimeError,
6502
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
6503
#else
6504
long val;
6505
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
6506
#if PY_MAJOR_VERSION < 3
6507
if (likely(v) && !PyLong_Check(v)) {
6508
PyObject *tmp = v;
6509
v = PyNumber_Long(tmp);
6510
Py_DECREF(tmp);
6511
}
6512
#endif
6513
if (likely(v)) {
6514
int one = 1; int is_little = (int)*(unsigned char *)&one;
6515
unsigned char *bytes = (unsigned char *)&val;
6516
int ret = _PyLong_AsByteArray((PyLongObject *)v,
6517
bytes, sizeof(val),
6518
is_little, !is_unsigned);
6519
Py_DECREF(v);
6520
if (likely(!ret))
6521
return val;
6522
}
6523
#endif
6524
return (long) -1;
6525
}
6526
} else {
6527
long val;
6528
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
6529
if (!tmp) return (long) -1;
6530
val = __Pyx_PyInt_As_long(tmp);
6531
Py_DECREF(tmp);
6532
return val;
6533
}
6534
raise_overflow:
6535
PyErr_SetString(PyExc_OverflowError,
6536
"value too large to convert to long");
6537
return (long) -1;
6538
raise_neg_overflow:
6539
PyErr_SetString(PyExc_OverflowError,
6540
"can't convert negative value to long");
6541
return (long) -1;
6542
}
6543
6544
/* CIntFromPy */
6545
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
6546
const int neg_one = (int) -1, const_zero = (int) 0;
6547
const int is_unsigned = neg_one > const_zero;
6548
#if PY_MAJOR_VERSION < 3
6549
if (likely(PyInt_Check(x))) {
6550
if (sizeof(int) < sizeof(long)) {
6551
__PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
6552
} else {
6553
long val = PyInt_AS_LONG(x);
6554
if (is_unsigned && unlikely(val < 0)) {
6555
goto raise_neg_overflow;
6556
}
6557
return (int) val;
6558
}
6559
} else
6560
#endif
6561
if (likely(PyLong_Check(x))) {
6562
if (is_unsigned) {
6563
#if CYTHON_USE_PYLONG_INTERNALS
6564
const digit* digits = ((PyLongObject*)x)->ob_digit;
6565
switch (Py_SIZE(x)) {
6566
case 0: return (int) 0;
6567
case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
6568
case 2:
6569
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
6570
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6571
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6572
} else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
6573
return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6574
}
6575
}
6576
break;
6577
case 3:
6578
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
6579
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6580
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6581
} else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
6582
return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6583
}
6584
}
6585
break;
6586
case 4:
6587
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
6588
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6589
__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])))
6590
} else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
6591
return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6592
}
6593
}
6594
break;
6595
}
6596
#endif
6597
#if CYTHON_COMPILING_IN_CPYTHON
6598
if (unlikely(Py_SIZE(x) < 0)) {
6599
goto raise_neg_overflow;
6600
}
6601
#else
6602
{
6603
int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
6604
if (unlikely(result < 0))
6605
return (int) -1;
6606
if (unlikely(result == 1))
6607
goto raise_neg_overflow;
6608
}
6609
#endif
6610
if (sizeof(int) <= sizeof(unsigned long)) {
6611
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
6612
#ifdef HAVE_LONG_LONG
6613
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
6614
__PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
6615
#endif
6616
}
6617
} else {
6618
#if CYTHON_USE_PYLONG_INTERNALS
6619
const digit* digits = ((PyLongObject*)x)->ob_digit;
6620
switch (Py_SIZE(x)) {
6621
case 0: return (int) 0;
6622
case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
6623
case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
6624
case -2:
6625
if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
6626
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6627
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6628
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
6629
return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6630
}
6631
}
6632
break;
6633
case 2:
6634
if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
6635
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6636
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6637
} else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
6638
return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6639
}
6640
}
6641
break;
6642
case -3:
6643
if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
6644
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6645
__PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6646
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
6647
return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6648
}
6649
}
6650
break;
6651
case 3:
6652
if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
6653
if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6654
__PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6655
} else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
6656
return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6657
}
6658
}
6659
break;
6660
case -4:
6661
if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
6662
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6663
__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])))
6664
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
6665
return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6666
}
6667
}
6668
break;
6669
case 4:
6670
if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
6671
if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6672
__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])))
6673
} else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
6674
return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6675
}
6676
}
6677
break;
6678
}
6679
#endif
6680
if (sizeof(int) <= sizeof(long)) {
6681
__PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
6682
#ifdef HAVE_LONG_LONG
6683
} else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
6684
__PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
6685
#endif
6686
}
6687
}
6688
{
6689
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
6690
PyErr_SetString(PyExc_RuntimeError,
6691
"_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
6692
#else
6693
int val;
6694
PyObject *v = __Pyx_PyNumber_IntOrLong(x);
6695
#if PY_MAJOR_VERSION < 3
6696
if (likely(v) && !PyLong_Check(v)) {
6697
PyObject *tmp = v;
6698
v = PyNumber_Long(tmp);
6699
Py_DECREF(tmp);
6700
}
6701
#endif
6702
if (likely(v)) {
6703
int one = 1; int is_little = (int)*(unsigned char *)&one;
6704
unsigned char *bytes = (unsigned char *)&val;
6705
int ret = _PyLong_AsByteArray((PyLongObject *)v,
6706
bytes, sizeof(val),
6707
is_little, !is_unsigned);
6708
Py_DECREF(v);
6709
if (likely(!ret))
6710
return val;
6711
}
6712
#endif
6713
return (int) -1;
6714
}
6715
} else {
6716
int val;
6717
PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
6718
if (!tmp) return (int) -1;
6719
val = __Pyx_PyInt_As_int(tmp);
6720
Py_DECREF(tmp);
6721
return val;
6722
}
6723
raise_overflow:
6724
PyErr_SetString(PyExc_OverflowError,
6725
"value too large to convert to int");
6726
return (int) -1;
6727
raise_neg_overflow:
6728
PyErr_SetString(PyExc_OverflowError,
6729
"can't convert negative value to int");
6730
return (int) -1;
6731
}
6732
6733
/* CheckBinaryVersion */
6734
static int __Pyx_check_binary_version(void) {
6735
char ctversion[4], rtversion[4];
6736
PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
6737
PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
6738
if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
6739
char message[200];
6740
PyOS_snprintf(message, sizeof(message),
6741
"compiletime version %s of module '%.100s' "
6742
"does not match runtime version %s",
6743
ctversion, __Pyx_MODULE_NAME, rtversion);
6744
return PyErr_WarnEx(NULL, message, 1);
6745
}
6746
return 0;
6747
}
6748
6749
/* ModuleImport */
6750
#ifndef __PYX_HAVE_RT_ImportModule
6751
#define __PYX_HAVE_RT_ImportModule
6752
static PyObject *__Pyx_ImportModule(const char *name) {
6753
PyObject *py_name = 0;
6754
PyObject *py_module = 0;
6755
py_name = __Pyx_PyIdentifier_FromString(name);
6756
if (!py_name)
6757
goto bad;
6758
py_module = PyImport_Import(py_name);
6759
Py_DECREF(py_name);
6760
return py_module;
6761
bad:
6762
Py_XDECREF(py_name);
6763
return 0;
6764
}
6765
#endif
6766
6767
/* TypeImport */
6768
#ifndef __PYX_HAVE_RT_ImportType
6769
#define __PYX_HAVE_RT_ImportType
6770
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
6771
size_t size, int strict)
6772
{
6773
PyObject *py_module = 0;
6774
PyObject *result = 0;
6775
PyObject *py_name = 0;
6776
char warning[200];
6777
Py_ssize_t basicsize;
6778
#ifdef Py_LIMITED_API
6779
PyObject *py_basicsize;
6780
#endif
6781
py_module = __Pyx_ImportModule(module_name);
6782
if (!py_module)
6783
goto bad;
6784
py_name = __Pyx_PyIdentifier_FromString(class_name);
6785
if (!py_name)
6786
goto bad;
6787
result = PyObject_GetAttr(py_module, py_name);
6788
Py_DECREF(py_name);
6789
py_name = 0;
6790
Py_DECREF(py_module);
6791
py_module = 0;
6792
if (!result)
6793
goto bad;
6794
if (!PyType_Check(result)) {
6795
PyErr_Format(PyExc_TypeError,
6796
"%.200s.%.200s is not a type object",
6797
module_name, class_name);
6798
goto bad;
6799
}
6800
#ifndef Py_LIMITED_API
6801
basicsize = ((PyTypeObject *)result)->tp_basicsize;
6802
#else
6803
py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
6804
if (!py_basicsize)
6805
goto bad;
6806
basicsize = PyLong_AsSsize_t(py_basicsize);
6807
Py_DECREF(py_basicsize);
6808
py_basicsize = 0;
6809
if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
6810
goto bad;
6811
#endif
6812
if (!strict && (size_t)basicsize > size) {
6813
PyOS_snprintf(warning, sizeof(warning),
6814
"%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
6815
module_name, class_name, basicsize, size);
6816
if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
6817
}
6818
else if ((size_t)basicsize != size) {
6819
PyErr_Format(PyExc_ValueError,
6820
"%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
6821
module_name, class_name, basicsize, size);
6822
goto bad;
6823
}
6824
return (PyTypeObject *)result;
6825
bad:
6826
Py_XDECREF(py_module);
6827
Py_XDECREF(result);
6828
return NULL;
6829
}
6830
#endif
6831
6832
/* VoidPtrImport */
6833
#ifndef __PYX_HAVE_RT_ImportVoidPtr
6834
#define __PYX_HAVE_RT_ImportVoidPtr
6835
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) {
6836
PyObject *d = 0;
6837
PyObject *cobj = 0;
6838
d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
6839
if (!d)
6840
goto bad;
6841
cobj = PyDict_GetItemString(d, name);
6842
if (!cobj) {
6843
PyErr_Format(PyExc_ImportError,
6844
"%.200s does not export expected C variable %.200s",
6845
PyModule_GetName(module), name);
6846
goto bad;
6847
}
6848
#if PY_VERSION_HEX >= 0x02070000
6849
if (!PyCapsule_IsValid(cobj, sig)) {
6850
PyErr_Format(PyExc_TypeError,
6851
"C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
6852
PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj));
6853
goto bad;
6854
}
6855
*p = PyCapsule_GetPointer(cobj, sig);
6856
#else
6857
{const char *desc, *s1, *s2;
6858
desc = (const char *)PyCObject_GetDesc(cobj);
6859
if (!desc)
6860
goto bad;
6861
s1 = desc; s2 = sig;
6862
while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
6863
if (*s1 != *s2) {
6864
PyErr_Format(PyExc_TypeError,
6865
"C variable %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
6866
PyModule_GetName(module), name, sig, desc);
6867
goto bad;
6868
}
6869
*p = PyCObject_AsVoidPtr(cobj);}
6870
#endif
6871
if (!(*p))
6872
goto bad;
6873
Py_DECREF(d);
6874
return 0;
6875
bad:
6876
Py_XDECREF(d);
6877
return -1;
6878
}
6879
#endif
6880
6881
/* InitStrings */
6882
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
6883
while (t->p) {
6884
#if PY_MAJOR_VERSION < 3
6885
if (t->is_unicode) {
6886
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
6887
} else if (t->intern) {
6888
*t->p = PyString_InternFromString(t->s);
6889
} else {
6890
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
6891
}
6892
#else
6893
if (t->is_unicode | t->is_str) {
6894
if (t->intern) {
6895
*t->p = PyUnicode_InternFromString(t->s);
6896
} else if (t->encoding) {
6897
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
6898
} else {
6899
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
6900
}
6901
} else {
6902
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
6903
}
6904
#endif
6905
if (!*t->p)
6906
return -1;
6907
++t;
6908
}
6909
return 0;
6910
}
6911
6912
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
6913
return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
6914
}
6915
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
6916
Py_ssize_t ignore;
6917
return __Pyx_PyObject_AsStringAndSize(o, &ignore);
6918
}
6919
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
6920
#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
6921
if (
6922
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
6923
__Pyx_sys_getdefaultencoding_not_ascii &&
6924
#endif
6925
PyUnicode_Check(o)) {
6926
#if PY_VERSION_HEX < 0x03030000
6927
char* defenc_c;
6928
PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
6929
if (!defenc) return NULL;
6930
defenc_c = PyBytes_AS_STRING(defenc);
6931
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
6932
{
6933
char* end = defenc_c + PyBytes_GET_SIZE(defenc);
6934
char* c;
6935
for (c = defenc_c; c < end; c++) {
6936
if ((unsigned char) (*c) >= 128) {
6937
PyUnicode_AsASCIIString(o);
6938
return NULL;
6939
}
6940
}
6941
}
6942
#endif
6943
*length = PyBytes_GET_SIZE(defenc);
6944
return defenc_c;
6945
#else
6946
if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
6947
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
6948
if (PyUnicode_IS_ASCII(o)) {
6949
*length = PyUnicode_GET_LENGTH(o);
6950
return PyUnicode_AsUTF8(o);
6951
} else {
6952
PyUnicode_AsASCIIString(o);
6953
return NULL;
6954
}
6955
#else
6956
return PyUnicode_AsUTF8AndSize(o, length);
6957
#endif
6958
#endif
6959
} else
6960
#endif
6961
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
6962
if (PyByteArray_Check(o)) {
6963
*length = PyByteArray_GET_SIZE(o);
6964
return PyByteArray_AS_STRING(o);
6965
} else
6966
#endif
6967
{
6968
char* result;
6969
int r = PyBytes_AsStringAndSize(o, &result, length);
6970
if (unlikely(r < 0)) {
6971
return NULL;
6972
} else {
6973
return result;
6974
}
6975
}
6976
}
6977
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
6978
int is_true = x == Py_True;
6979
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
6980
else return PyObject_IsTrue(x);
6981
}
6982
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
6983
#if CYTHON_USE_TYPE_SLOTS
6984
PyNumberMethods *m;
6985
#endif
6986
const char *name = NULL;
6987
PyObject *res = NULL;
6988
#if PY_MAJOR_VERSION < 3
6989
if (PyInt_Check(x) || PyLong_Check(x))
6990
#else
6991
if (PyLong_Check(x))
6992
#endif
6993
return __Pyx_NewRef(x);
6994
#if CYTHON_USE_TYPE_SLOTS
6995
m = Py_TYPE(x)->tp_as_number;
6996
#if PY_MAJOR_VERSION < 3
6997
if (m && m->nb_int) {
6998
name = "int";
6999
res = PyNumber_Int(x);
7000
}
7001
else if (m && m->nb_long) {
7002
name = "long";
7003
res = PyNumber_Long(x);
7004
}
7005
#else
7006
if (m && m->nb_int) {
7007
name = "int";
7008
res = PyNumber_Long(x);
7009
}
7010
#endif
7011
#else
7012
res = PyNumber_Int(x);
7013
#endif
7014
if (res) {
7015
#if PY_MAJOR_VERSION < 3
7016
if (!PyInt_Check(res) && !PyLong_Check(res)) {
7017
#else
7018
if (!PyLong_Check(res)) {
7019
#endif
7020
PyErr_Format(PyExc_TypeError,
7021
"__%.4s__ returned non-%.4s (type %.200s)",
7022
name, name, Py_TYPE(res)->tp_name);
7023
Py_DECREF(res);
7024
return NULL;
7025
}
7026
}
7027
else if (!PyErr_Occurred()) {
7028
PyErr_SetString(PyExc_TypeError,
7029
"an integer is required");
7030
}
7031
return res;
7032
}
7033
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
7034
Py_ssize_t ival;
7035
PyObject *x;
7036
#if PY_MAJOR_VERSION < 3
7037
if (likely(PyInt_CheckExact(b))) {
7038
if (sizeof(Py_ssize_t) >= sizeof(long))
7039
return PyInt_AS_LONG(b);
7040
else
7041
return PyInt_AsSsize_t(x);
7042
}
7043
#endif
7044
if (likely(PyLong_CheckExact(b))) {
7045
#if CYTHON_USE_PYLONG_INTERNALS
7046
const digit* digits = ((PyLongObject*)b)->ob_digit;
7047
const Py_ssize_t size = Py_SIZE(b);
7048
if (likely(__Pyx_sst_abs(size) <= 1)) {
7049
ival = likely(size) ? digits[0] : 0;
7050
if (size == -1) ival = -ival;
7051
return ival;
7052
} else {
7053
switch (size) {
7054
case 2:
7055
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
7056
return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7057
}
7058
break;
7059
case -2:
7060
if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
7061
return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7062
}
7063
break;
7064
case 3:
7065
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
7066
return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7067
}
7068
break;
7069
case -3:
7070
if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
7071
return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
7072
}
7073
break;
7074
case 4:
7075
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
7076
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]));
7077
}
7078
break;
7079
case -4:
7080
if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
7081
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]));
7082
}
7083
break;
7084
}
7085
}
7086
#endif
7087
return PyLong_AsSsize_t(b);
7088
}
7089
x = PyNumber_Index(b);
7090
if (!x) return -1;
7091
ival = PyInt_AsSsize_t(x);
7092
Py_DECREF(x);
7093
return ival;
7094
}
7095
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
7096
return PyInt_FromSize_t(ival);
7097
}
7098
7099
7100
#endif /* Py_PYTHON_H */
7101
7102