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