Commit 71de578a authored by Stefan Behnel's avatar Stefan Behnel

replace generic "COMPILING_IN_*" C macros with feature specific guards that...

replace generic "COMPILING_IN_*" C macros with feature specific guards that allow a more fine-grained adaptation to C-API implementations
parent ebf960e4
...@@ -2597,7 +2597,7 @@ class IteratorNode(ExprNode): ...@@ -2597,7 +2597,7 @@ class IteratorNode(ExprNode):
inc_dec = '--' inc_dec = '--'
else: else:
inc_dec = '++' inc_dec = '++'
code.putln("#if CYTHON_COMPILING_IN_CPYTHON") code.putln("#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS")
code.putln( code.putln(
"%s = Py%s_GET_ITEM(%s, %s); __Pyx_INCREF(%s); %s%s; %s" % ( "%s = Py%s_GET_ITEM(%s, %s); __Pyx_INCREF(%s); %s%s; %s" % (
result_name, result_name,
...@@ -5484,7 +5484,7 @@ class PyMethodCallNode(SimpleCallNode): ...@@ -5484,7 +5484,7 @@ class PyMethodCallNode(SimpleCallNode):
else: else:
likely_method = 'unlikely' likely_method = 'unlikely'
code.putln("if (CYTHON_COMPILING_IN_CPYTHON && %s(PyMethod_Check(%s))) {" % (likely_method, function)) code.putln("if (CYTHON_UNPACK_METHODS && %s(PyMethod_Check(%s))) {" % (likely_method, function))
code.putln("%s = PyMethod_GET_SELF(%s);" % (self_arg, function)) code.putln("%s = PyMethod_GET_SELF(%s);" % (self_arg, function))
# the following is always true in Py3 (kept only for safety), # the following is always true in Py3 (kept only for safety),
# but is false for unbound methods in Py2 # but is false for unbound methods in Py2
...@@ -7034,7 +7034,7 @@ class SequenceNode(ExprNode): ...@@ -7034,7 +7034,7 @@ class SequenceNode(ExprNode):
code.putln("PyObject* sequence = %s;" % rhs.py_result()) code.putln("PyObject* sequence = %s;" % rhs.py_result())
# list/tuple => check size # list/tuple => check size
code.putln("#if CYTHON_COMPILING_IN_CPYTHON") code.putln("#if !CYTHON_COMPILING_IN_PYPY")
code.putln("Py_ssize_t size = Py_SIZE(sequence);") code.putln("Py_ssize_t size = Py_SIZE(sequence);")
code.putln("#else") code.putln("#else")
code.putln("Py_ssize_t size = PySequence_Size(sequence);") # < 0 => exception code.putln("Py_ssize_t size = PySequence_Size(sequence);") # < 0 => exception
...@@ -7048,7 +7048,7 @@ class SequenceNode(ExprNode): ...@@ -7048,7 +7048,7 @@ class SequenceNode(ExprNode):
code.putln(code.error_goto(self.pos)) code.putln(code.error_goto(self.pos))
code.putln("}") code.putln("}")
code.putln("#if CYTHON_COMPILING_IN_CPYTHON") code.putln("#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS")
# unpack items from list/tuple in unrolled loop (can't fail) # unpack items from list/tuple in unrolled loop (can't fail)
if len(sequence_types) == 2: if len(sequence_types) == 2:
code.putln("if (likely(Py%s_CheckExact(sequence))) {" % sequence_types[0]) code.putln("if (likely(Py%s_CheckExact(sequence))) {" % sequence_types[0])
......
...@@ -1397,7 +1397,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1397,7 +1397,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
if base_type.scope and base_type.scope.needs_gc(): if base_type.scope and base_type.scope.needs_gc():
code.putln("PyObject_GC_Track(o);") code.putln("PyObject_GC_Track(o);")
else: else:
code.putln("#if CYTHON_COMPILING_IN_CPYTHON") code.putln("#if CYTHON_USE_TYPE_SLOTS")
code.putln("if (PyType_IS_GC(Py_TYPE(o)->tp_base))") code.putln("if (PyType_IS_GC(Py_TYPE(o)->tp_base))")
code.putln("#endif") code.putln("#endif")
code.putln("PyObject_GC_Track(o);") code.putln("PyObject_GC_Track(o);")
......
...@@ -447,7 +447,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) { ...@@ -447,7 +447,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
Py_DECREF(result); Py_DECREF(result);
#endif #endif
} }
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_USE_TYPE_SLOTS
return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, $empty_tuple, NULL); return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, $empty_tuple, NULL);
#else #else
return PyObject_Call((PyObject*)&PyFrozenSet_Type, $empty_tuple, NULL); return PyObject_Call((PyObject*)&PyFrozenSet_Type, $empty_tuple, NULL);
...@@ -463,7 +463,7 @@ static CYTHON_INLINE int __Pyx_PySet_Update(PyObject* set, PyObject* it); /*prot ...@@ -463,7 +463,7 @@ static CYTHON_INLINE int __Pyx_PySet_Update(PyObject* set, PyObject* it); /*prot
static CYTHON_INLINE int __Pyx_PySet_Update(PyObject* set, PyObject* it) { static CYTHON_INLINE int __Pyx_PySet_Update(PyObject* set, PyObject* it) {
PyObject *retval; PyObject *retval;
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_USE_TYPE_SLOTS && !CYTHON_COMPILING_IN_PYPY
if (PyAnySet_Check(it)) { if (PyAnySet_Check(it)) {
if (PySet_GET_SIZE(it) == 0) if (PySet_GET_SIZE(it) == 0)
return 0; return 0;
......
...@@ -100,7 +100,7 @@ static {{type}} __Pyx_PyComplex_As_{{type_name}}(PyObject*); ...@@ -100,7 +100,7 @@ static {{type}} __Pyx_PyComplex_As_{{type_name}}(PyObject*);
static {{type}} __Pyx_PyComplex_As_{{type_name}}(PyObject* o) { static {{type}} __Pyx_PyComplex_As_{{type_name}}(PyObject* o) {
Py_complex cval; Py_complex cval;
#if CYTHON_COMPILING_IN_CPYTHON #if !CYTHON_COMPILING_IN_PYPY
if (PyComplex_CheckExact(o)) if (PyComplex_CheckExact(o))
cval = ((PyComplexObject *)o)->cval; cval = ((PyComplexObject *)o)->cval;
else else
......
...@@ -16,7 +16,7 @@ static CYTHON_INLINE PyObject* __Pyx_Generator_Yield_From(__pyx_CoroutineObject ...@@ -16,7 +16,7 @@ static CYTHON_INLINE PyObject* __Pyx_Generator_Yield_From(__pyx_CoroutineObject
} else } else
#endif #endif
{ {
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_USE_TYPE_SLOTS
if (likely(Py_TYPE(source)->tp_iter)) { if (likely(Py_TYPE(source)->tp_iter)) {
source_gen = Py_TYPE(source)->tp_iter(source); source_gen = Py_TYPE(source)->tp_iter(source);
if (unlikely(!source_gen)) if (unlikely(!source_gen))
...@@ -180,13 +180,13 @@ static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAwaitableIter(PyObject *o) { ...@@ -180,13 +180,13 @@ static CYTHON_INLINE PyObject *__Pyx_Coroutine_GetAwaitableIter(PyObject *o) {
// adapted from genobject.c in Py3.5 // adapted from genobject.c in Py3.5
static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *obj) { static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *obj) {
PyObject *res; PyObject *res;
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_TYPE_SLOTS && PY_MAJOR_VERSION >= 3
__Pyx_PyAsyncMethodsStruct* am = __Pyx_PyType_AsAsync(obj); __Pyx_PyAsyncMethodsStruct* am = __Pyx_PyType_AsAsync(obj);
if (likely(am && am->am_await)) { if (likely(am && am->am_await)) {
res = (*am->am_await)(obj); res = (*am->am_await)(obj);
} else } else
#endif #endif
#if (CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500B2) || defined(PyCoro_CheckExact) #if PY_VERSION_HEX >= 0x030500B2 || defined(PyCoro_CheckExact)
if (PyCoro_CheckExact(obj)) { if (PyCoro_CheckExact(obj)) {
Py_INCREF(obj); Py_INCREF(obj);
return obj; return obj;
...@@ -202,7 +202,7 @@ static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *obj) { ...@@ -202,7 +202,7 @@ static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *obj) {
{ {
PyObject *method = __Pyx_PyObject_GetAttrStr(obj, PYIDENT("__await__")); PyObject *method = __Pyx_PyObject_GetAttrStr(obj, PYIDENT("__await__"));
if (unlikely(!method)) goto slot_error; if (unlikely(!method)) goto slot_error;
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_UNPACK_METHODS
if (likely(PyMethod_Check(method))) { if (likely(PyMethod_Check(method))) {
PyObject *self = PyMethod_GET_SELF(method); PyObject *self = PyMethod_GET_SELF(method);
if (likely(self)) { if (likely(self)) {
...@@ -226,7 +226,7 @@ static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *obj) { ...@@ -226,7 +226,7 @@ static PyObject *__Pyx__Coroutine_GetAwaitableIter(PyObject *obj) {
#ifdef __Pyx_Coroutine_USED #ifdef __Pyx_Coroutine_USED
is_coroutine |= __Pyx_Coroutine_CheckExact(res); is_coroutine |= __Pyx_Coroutine_CheckExact(res);
#endif #endif
#if (CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500B2) || defined(PyCoro_CheckExact) #if PY_VERSION_HEX >= 0x030500B2 || defined(PyCoro_CheckExact)
is_coroutine |= PyCoro_CheckExact(res); is_coroutine |= PyCoro_CheckExact(res);
#endif #endif
if (unlikely(is_coroutine)) { if (unlikely(is_coroutine)) {
...@@ -445,11 +445,11 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) { ...@@ -445,11 +445,11 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) {
else if (unlikely(PyTuple_Check(ev))) { else if (unlikely(PyTuple_Check(ev))) {
// if it's a tuple, it is interpreted as separate constructor arguments (surprise!) // if it's a tuple, it is interpreted as separate constructor arguments (surprise!)
if (PyTuple_GET_SIZE(ev) >= 1) { if (PyTuple_GET_SIZE(ev) >= 1) {
#if !CYTHON_COMPILING_IN_CPYTHON #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
value = PySequence_ITEM(ev, 0);
#else
value = PyTuple_GET_ITEM(ev, 0); value = PyTuple_GET_ITEM(ev, 0);
Py_INCREF(value); Py_INCREF(value);
#else
value = PySequence_ITEM(ev, 0);
#endif #endif
} else { } else {
Py_INCREF(Py_None); Py_INCREF(Py_None);
...@@ -1080,7 +1080,7 @@ static PyObject *__Pyx_CoroutineAwait_self(PyObject *self) { ...@@ -1080,7 +1080,7 @@ static PyObject *__Pyx_CoroutineAwait_self(PyObject *self) {
return self; return self;
} }
#if CYTHON_COMPILING_IN_CPYTHON #if !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_CoroutineAwait_no_new(CYTHON_UNUSED PyTypeObject *type, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwargs) { static PyObject *__Pyx_CoroutineAwait_no_new(CYTHON_UNUSED PyTypeObject *type, CYTHON_UNUSED PyObject *args, CYTHON_UNUSED PyObject *kwargs) {
PyErr_SetString(PyExc_TypeError, "cannot instantiate type, use 'await coroutine' instead"); PyErr_SetString(PyExc_TypeError, "cannot instantiate type, use 'await coroutine' instead");
return NULL; return NULL;
...@@ -1135,7 +1135,7 @@ static PyTypeObject __pyx_CoroutineAwaitType_type = { ...@@ -1135,7 +1135,7 @@ static PyTypeObject __pyx_CoroutineAwaitType_type = {
0, /*tp_dictoffset*/ 0, /*tp_dictoffset*/
0, /*tp_init*/ 0, /*tp_init*/
0, /*tp_alloc*/ 0, /*tp_alloc*/
#if CYTHON_COMPILING_IN_CPYTHON #if !CYTHON_COMPILING_IN_PYPY
__Pyx_CoroutineAwait_no_new, /*tp_new*/ __Pyx_CoroutineAwait_no_new, /*tp_new*/
#else #else
0, /*tp_new*/ 0, /*tp_new*/
...@@ -1280,7 +1280,7 @@ static PyGetSetDef __pyx_Coroutine_getsets[] = { ...@@ -1280,7 +1280,7 @@ static PyGetSetDef __pyx_Coroutine_getsets[] = {
{0, 0, 0, 0, 0} {0, 0, 0, 0, 0}
}; };
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static __Pyx_PyAsyncMethodsStruct __pyx_Coroutine_as_async = { static __Pyx_PyAsyncMethodsStruct __pyx_Coroutine_as_async = {
__Pyx_Coroutine_await, /*am_await*/ __Pyx_Coroutine_await, /*am_await*/
0, /*am_aiter*/ 0, /*am_aiter*/
...@@ -1297,7 +1297,7 @@ static PyTypeObject __pyx_CoroutineType_type = { ...@@ -1297,7 +1297,7 @@ static PyTypeObject __pyx_CoroutineType_type = {
0, /*tp_print*/ 0, /*tp_print*/
0, /*tp_getattr*/ 0, /*tp_getattr*/
0, /*tp_setattr*/ 0, /*tp_setattr*/
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
&__pyx_Coroutine_as_async, /*tp_as_async (tp_reserved)*/ &__pyx_Coroutine_as_async, /*tp_as_async (tp_reserved)*/
#else #else
0, /*tp_reserved*/ 0, /*tp_reserved*/
......
...@@ -251,7 +251,7 @@ __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { ...@@ -251,7 +251,7 @@ __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
return -1; return -1;
// Cache result // Cache result
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
op->defaults_tuple = PyTuple_GET_ITEM(res, 0); op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
Py_INCREF(op->defaults_tuple); Py_INCREF(op->defaults_tuple);
op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
...@@ -745,7 +745,7 @@ static CYTHON_INLINE int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, P ...@@ -745,7 +745,7 @@ static CYTHON_INLINE int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, P
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *)
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
PyList_GET_ITEM(cyfunctions, i); PyList_GET_ITEM(cyfunctions, i);
#else #else
PySequence_ITEM(cyfunctions, i); PySequence_ITEM(cyfunctions, i);
...@@ -754,7 +754,7 @@ static CYTHON_INLINE int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, P ...@@ -754,7 +754,7 @@ static CYTHON_INLINE int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, P
#endif #endif
Py_INCREF(classobj); Py_INCREF(classobj);
m->func_classobj = classobj; m->func_classobj = classobj;
#if !CYTHON_COMPILING_IN_CPYTHON #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
Py_DECREF((PyObject*)m); Py_DECREF((PyObject*)m);
#endif #endif
} }
...@@ -910,13 +910,13 @@ __pyx_FusedFunction_getitem(__pyx_FusedFunctionObject *self, PyObject *idx) ...@@ -910,13 +910,13 @@ __pyx_FusedFunction_getitem(__pyx_FusedFunctionObject *self, PyObject *idx)
return NULL; return NULL;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
PyObject *item = PyTuple_GET_ITEM(idx, i); PyObject *item = PyTuple_GET_ITEM(idx, i);
#else #else
PyObject *item = PySequence_ITEM(idx, i); PyObject *item = PySequence_ITEM(idx, i);
#endif #endif
string = _obj_to_str(item); string = _obj_to_str(item);
#if !CYTHON_COMPILING_IN_CPYTHON #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
Py_DECREF(item); Py_DECREF(item);
#endif #endif
if (!string || PyList_Append(list, string) < 0) if (!string || PyList_Append(list, string) < 0)
...@@ -1028,14 +1028,14 @@ __pyx_FusedFunction_call(PyObject *func, PyObject *args, PyObject *kw) ...@@ -1028,14 +1028,14 @@ __pyx_FusedFunction_call(PyObject *func, PyObject *args, PyObject *kw)
return NULL; return NULL;
self = binding_func->self; self = binding_func->self;
#if !CYTHON_COMPILING_IN_CPYTHON #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
Py_INCREF(self); Py_INCREF(self);
#endif #endif
Py_INCREF(self); Py_INCREF(self);
PyTuple_SET_ITEM(new_args, 0, self); PyTuple_SET_ITEM(new_args, 0, self);
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
PyObject *item = PyTuple_GET_ITEM(args, i); PyObject *item = PyTuple_GET_ITEM(args, i);
Py_INCREF(item); Py_INCREF(item);
#else #else
...@@ -1051,7 +1051,7 @@ __pyx_FusedFunction_call(PyObject *func, PyObject *args, PyObject *kw) ...@@ -1051,7 +1051,7 @@ __pyx_FusedFunction_call(PyObject *func, PyObject *args, PyObject *kw)
PyErr_SetString(PyExc_TypeError, "Need at least one argument, 0 given."); PyErr_SetString(PyExc_TypeError, "Need at least one argument, 0 given.");
return NULL; return NULL;
} }
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
self = PyTuple_GET_ITEM(args, 0); self = PyTuple_GET_ITEM(args, 0);
#else #else
self = PySequence_ITEM(args, 0); if (unlikely(!self)) return NULL; self = PySequence_ITEM(args, 0); if (unlikely(!self)) return NULL;
...@@ -1070,7 +1070,7 @@ __pyx_FusedFunction_call(PyObject *func, PyObject *args, PyObject *kw) ...@@ -1070,7 +1070,7 @@ __pyx_FusedFunction_call(PyObject *func, PyObject *args, PyObject *kw)
goto bad; goto bad;
} }
} }
#if !CYTHON_COMPILING_IN_CPYTHON #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
Py_XDECREF(self); Py_XDECREF(self);
self = NULL; self = NULL;
#endif #endif
...@@ -1097,7 +1097,7 @@ __pyx_FusedFunction_call(PyObject *func, PyObject *args, PyObject *kw) ...@@ -1097,7 +1097,7 @@ __pyx_FusedFunction_call(PyObject *func, PyObject *args, PyObject *kw)
result = __pyx_FusedFunction_callfunction(func, args, kw); result = __pyx_FusedFunction_callfunction(func, args, kw);
bad: bad:
#if !CYTHON_COMPILING_IN_CPYTHON #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
Py_XDECREF(self); Py_XDECREF(self);
#endif #endif
Py_XDECREF(new_args); Py_XDECREF(new_args);
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
/////////////// PyThreadStateGet.proto /////////////// /////////////// PyThreadStateGet.proto ///////////////
//@substitute: naming //@substitute: naming
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare PyThreadState *$local_tstate_cname; #define __Pyx_PyThreadState_declare PyThreadState *$local_tstate_cname;
#define __Pyx_PyThreadState_assign $local_tstate_cname = PyThreadState_GET(); #define __Pyx_PyThreadState_assign $local_tstate_cname = PyThreadState_GET();
#else #else
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
/////////////// PyErrExceptionMatches.proto /////////////// /////////////// PyErrExceptionMatches.proto ///////////////
//@substitute: naming //@substitute: naming
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState($local_tstate_cname, err) #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState($local_tstate_cname, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else #else
...@@ -30,7 +30,7 @@ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tsta ...@@ -30,7 +30,7 @@ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tsta
/////////////// PyErrExceptionMatches /////////////// /////////////// PyErrExceptionMatches ///////////////
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) { static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
PyObject *exc_type = tstate->curexc_type; PyObject *exc_type = tstate->curexc_type;
if (exc_type == err) return 1; if (exc_type == err) return 1;
...@@ -43,7 +43,7 @@ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tsta ...@@ -43,7 +43,7 @@ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tsta
//@substitute: naming //@substitute: naming
//@requires: PyThreadStateGet //@requires: PyThreadStateGet
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_FAST_THREAD_STATE
#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState($local_tstate_cname, type, value, tb) #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState($local_tstate_cname, type, value, tb)
...@@ -60,7 +60,7 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject ...@@ -60,7 +60,7 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject
/////////////// PyErrFetchRestore /////////////// /////////////// PyErrFetchRestore ///////////////
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
PyObject *tmp_type, *tmp_value, *tmp_tb; PyObject *tmp_type, *tmp_value, *tmp_tb;
tmp_type = tstate->curexc_type; tmp_type = tstate->curexc_type;
...@@ -285,7 +285,7 @@ bad: ...@@ -285,7 +285,7 @@ bad:
//@substitute: naming //@substitute: naming
//@requires: PyThreadStateGet //@requires: PyThreadStateGet
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb) __Pyx__GetException($local_tstate_cname, type, value, tb) #define __Pyx_GetException(type, value, tb) __Pyx__GetException($local_tstate_cname, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); /*proto*/
#else #else
...@@ -294,13 +294,13 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); ...@@ -294,13 +294,13 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
/////////////// GetException /////////////// /////////////// GetException ///////////////
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#else #else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
#endif #endif
PyObject *local_type, *local_value, *local_tb; PyObject *local_type, *local_value, *local_tb;
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_FAST_THREAD_STATE
PyObject *tmp_type, *tmp_value, *tmp_tb; PyObject *tmp_type, *tmp_value, *tmp_tb;
local_type = tstate->curexc_type; local_type = tstate->curexc_type;
local_value = tstate->curexc_value; local_value = tstate->curexc_value;
...@@ -312,7 +312,7 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) ...@@ -312,7 +312,7 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
PyErr_Fetch(&local_type, &local_value, &local_tb); PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif #endif
PyErr_NormalizeException(&local_type, &local_value, &local_tb); PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_FAST_THREAD_STATE
if (unlikely(tstate->curexc_type)) if (unlikely(tstate->curexc_type))
#else #else
if (unlikely(PyErr_Occurred())) if (unlikely(PyErr_Occurred()))
...@@ -332,7 +332,7 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) ...@@ -332,7 +332,7 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
*type = local_type; *type = local_type;
*value = local_value; *value = local_value;
*tb = local_tb; *tb = local_tb;
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_FAST_THREAD_STATE
tmp_type = tstate->exc_type; tmp_type = tstate->exc_type;
tmp_value = tstate->exc_value; tmp_value = tstate->exc_value;
tmp_tb = tstate->exc_traceback; tmp_tb = tstate->exc_traceback;
...@@ -366,7 +366,7 @@ static CYTHON_INLINE void __Pyx_ReraiseException(void); /*proto*/ ...@@ -366,7 +366,7 @@ static CYTHON_INLINE void __Pyx_ReraiseException(void); /*proto*/
static CYTHON_INLINE void __Pyx_ReraiseException(void) { static CYTHON_INLINE void __Pyx_ReraiseException(void) {
PyObject *type = NULL, *value = NULL, *tb = NULL; PyObject *type = NULL, *value = NULL, *tb = NULL;
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_FAST_THREAD_STATE
PyThreadState *tstate = PyThreadState_GET(); PyThreadState *tstate = PyThreadState_GET();
type = tstate->exc_type; type = tstate->exc_type;
value = tstate->exc_value; value = tstate->exc_value;
...@@ -375,7 +375,7 @@ static CYTHON_INLINE void __Pyx_ReraiseException(void) { ...@@ -375,7 +375,7 @@ static CYTHON_INLINE void __Pyx_ReraiseException(void) {
PyErr_GetExcInfo(&type, &value, &tb); PyErr_GetExcInfo(&type, &value, &tb);
#endif #endif
if (!type || type == Py_None) { if (!type || type == Py_None) {
#if !CYTHON_COMPILING_IN_CPYTHON #if !CYTHON_FAST_THREAD_STATE
Py_XDECREF(type); Py_XDECREF(type);
Py_XDECREF(value); Py_XDECREF(value);
Py_XDECREF(tb); Py_XDECREF(tb);
...@@ -384,7 +384,7 @@ static CYTHON_INLINE void __Pyx_ReraiseException(void) { ...@@ -384,7 +384,7 @@ static CYTHON_INLINE void __Pyx_ReraiseException(void) {
PyErr_SetString(PyExc_RuntimeError, PyErr_SetString(PyExc_RuntimeError,
"No active exception to reraise"); "No active exception to reraise");
} else { } else {
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_FAST_THREAD_STATE
Py_INCREF(type); Py_INCREF(type);
Py_XINCREF(value); Py_XINCREF(value);
Py_XINCREF(tb); Py_XINCREF(tb);
...@@ -398,7 +398,7 @@ static CYTHON_INLINE void __Pyx_ReraiseException(void) { ...@@ -398,7 +398,7 @@ static CYTHON_INLINE void __Pyx_ReraiseException(void) {
//@substitute: naming //@substitute: naming
//@requires: PyThreadStateGet //@requires: PyThreadStateGet
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave($local_tstate_cname, type, value, tb) #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave($local_tstate_cname, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); /*proto*/
#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset($local_tstate_cname, type, value, tb) #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset($local_tstate_cname, type, value, tb)
...@@ -412,7 +412,7 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject ...@@ -412,7 +412,7 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject
/////////////// SaveResetException /////////////// /////////////// SaveResetException ///////////////
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
*type = tstate->exc_type; *type = tstate->exc_type;
*value = tstate->exc_value; *value = tstate->exc_value;
...@@ -440,7 +440,7 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject ...@@ -440,7 +440,7 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject
//@substitute: naming //@substitute: naming
//@requires: PyThreadStateGet //@requires: PyThreadStateGet
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap($local_tstate_cname, type, value, tb) #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap($local_tstate_cname, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); /*proto*/
#else #else
...@@ -449,7 +449,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, ...@@ -449,7 +449,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value,
/////////////// SwapException /////////////// /////////////// SwapException ///////////////
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
PyObject *tmp_type, *tmp_value, *tmp_tb; PyObject *tmp_type, *tmp_value, *tmp_tb;
tmp_type = tstate->exc_type; tmp_type = tstate->exc_type;
......
...@@ -35,9 +35,23 @@ ...@@ -35,9 +35,23 @@
#ifdef PYPY_VERSION #ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0 #define CYTHON_COMPILING_IN_CPYTHON 0
#define CYTHON_USE_TYPE_SLOTS 0
#define CYTHON_USE_PYLIST_INTERNALS 0
#define CYTHON_USE_UNICODE_INTERNALS 0
#define CYTHON_AVOID_BORROWED_REFS 1
#define CYTHON_ASSUME_SAFE_MACROS 0
#define CYTHON_UNPACK_METHODS 0
#define CYTHON_FAST_THREAD_STATE 0
#else #else
#define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1 #define CYTHON_COMPILING_IN_CPYTHON 1
#define CYTHON_USE_TYPE_SLOTS 1
#define CYTHON_USE_PYLIST_INTERNALS 1
#define CYTHON_USE_UNICODE_INTERNALS 1
#define CYTHON_AVOID_BORROWED_REFS 0
#define CYTHON_ASSUME_SAFE_MACROS 1
#define CYTHON_UNPACK_METHODS 1
#define CYTHON_FAST_THREAD_STATE 1
#endif #endif
#if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000 #if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
...@@ -221,7 +235,7 @@ ...@@ -221,7 +235,7 @@
#if PY_VERSION_HEX >= 0x030500B1 #if PY_VERSION_HEX >= 0x030500B1
#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
#elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #elif PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
typedef struct { typedef struct {
unaryfunc am_await; unaryfunc am_await;
unaryfunc am_aiter; unaryfunc am_aiter;
......
...@@ -145,7 +145,7 @@ static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); /*pro ...@@ -145,7 +145,7 @@ static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); /*pro
static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) { static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) {
PyObject* next; PyObject* next;
iternextfunc iternext = Py_TYPE(iterator)->tp_iternext; iternextfunc iternext = Py_TYPE(iterator)->tp_iternext;
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_USE_TYPE_SLOTS
if (unlikely(!iternext)) { if (unlikely(!iternext)) {
#else #else
if (unlikely(!iternext) || unlikely(!PyIter_Check(iterator))) { if (unlikely(!iternext) || unlikely(!PyIter_Check(iterator))) {
...@@ -157,7 +157,7 @@ static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* ...@@ -157,7 +157,7 @@ static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject*
next = iternext(iterator); next = iternext(iterator);
if (likely(next)) if (likely(next))
return next; return next;
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_USE_TYPE_SLOTS
#if PY_VERSION_HEX >= 0x02070000 #if PY_VERSION_HEX >= 0x02070000
if (unlikely(iternext == &_PyObject_NextNotImplemented)) if (unlikely(iternext == &_PyObject_NextNotImplemented))
return NULL; return NULL;
...@@ -190,7 +190,7 @@ static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ ...@@ -190,7 +190,7 @@ static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
// detects an error that occurred in the iterator, it returns -1. // detects an error that occurred in the iterator, it returns -1.
static CYTHON_INLINE int __Pyx_IterFinish(void) { static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_FAST_THREAD_STATE
PyThreadState *tstate = PyThreadState_GET(); PyThreadState *tstate = PyThreadState_GET();
PyObject* exc_type = tstate->curexc_type; PyObject* exc_type = tstate->curexc_type;
if (unlikely(exc_type)) { if (unlikely(exc_type)) {
...@@ -281,7 +281,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j ...@@ -281,7 +281,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_{{type}}_Fast(PyObject *o, Py_ssize_t i, static CYTHON_INLINE PyObject *__Pyx_GetItemInt_{{type}}_Fast(PyObject *o, Py_ssize_t i,
CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int wraparound,
CYTHON_NCP_UNUSED int boundscheck) { CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
if (wraparound & unlikely(i < 0)) i += Py{{type}}_GET_SIZE(o); if (wraparound & unlikely(i < 0)) i += Py{{type}}_GET_SIZE(o);
if ((!boundscheck) || likely((0 <= i) & (i < Py{{type}}_GET_SIZE(o)))) { if ((!boundscheck) || likely((0 <= i) & (i < Py{{type}}_GET_SIZE(o)))) {
PyObject *r = Py{{type}}_GET_ITEM(o, i); PyObject *r = Py{{type}}_GET_ITEM(o, i);
...@@ -298,7 +298,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_{{type}}_Fast(PyObject *o, Py_ss ...@@ -298,7 +298,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_{{type}}_Fast(PyObject *o, Py_ss
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int wraparound,
CYTHON_NCP_UNUSED int boundscheck) { CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
if (is_list || PyList_CheckExact(o)) { if (is_list || PyList_CheckExact(o)) {
Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
...@@ -364,7 +364,7 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb ...@@ -364,7 +364,7 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
if (is_list || PyList_CheckExact(o)) { if (is_list || PyList_CheckExact(o)) {
Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
...@@ -429,7 +429,7 @@ static CYTHON_INLINE int __Pyx_DelItem_Generic(PyObject *o, PyObject *j) { ...@@ -429,7 +429,7 @@ static CYTHON_INLINE int __Pyx_DelItem_Generic(PyObject *o, PyObject *j) {
static CYTHON_INLINE int __Pyx_DelItemInt_Fast(PyObject *o, Py_ssize_t i, static CYTHON_INLINE int __Pyx_DelItemInt_Fast(PyObject *o, Py_ssize_t i,
CYTHON_UNUSED int is_list, CYTHON_NCP_UNUSED int wraparound) { CYTHON_UNUSED int is_list, CYTHON_NCP_UNUSED int wraparound) {
#if CYTHON_COMPILING_IN_PYPY #if !CYTHON_USE_TYPE_SLOTS
if (is_list || PySequence_Check(o)) { if (is_list || PySequence_Check(o)) {
return PySequence_DelItem(o, i); return PySequence_DelItem(o, i);
} }
...@@ -484,7 +484,7 @@ static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value, ...@@ -484,7 +484,7 @@ static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value,
Py_ssize_t cstart, Py_ssize_t cstop, Py_ssize_t cstart, Py_ssize_t cstop,
PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_USE_TYPE_SLOTS
PyMappingMethods* mp; PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3 #if PY_MAJOR_VERSION < 3
PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
...@@ -570,7 +570,7 @@ static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value, ...@@ -570,7 +570,7 @@ static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value,
Py_XDECREF(owned_stop); Py_XDECREF(owned_stop);
if (unlikely(!py_slice)) goto bad; if (unlikely(!py_slice)) goto bad;
} }
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_USE_TYPE_SLOTS
{{if access == 'Get'}} {{if access == 'Get'}}
result = mp->mp_subscript(obj, py_slice); result = mp->mp_subscript(obj, py_slice);
#else #else
...@@ -720,7 +720,7 @@ static PyObject *__Pyx_FindInheritedMetaclass(PyObject *bases) { ...@@ -720,7 +720,7 @@ static PyObject *__Pyx_FindInheritedMetaclass(PyObject *bases) {
PyObject *metaclass; PyObject *metaclass;
if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
PyTypeObject *metatype; PyTypeObject *metatype;
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
PyObject *base = PyTuple_GET_ITEM(bases, 0); PyObject *base = PyTuple_GET_ITEM(bases, 0);
#else #else
PyObject *base = PySequence_ITEM(bases, 0); PyObject *base = PySequence_ITEM(bases, 0);
...@@ -739,7 +739,7 @@ static PyObject *__Pyx_FindInheritedMetaclass(PyObject *bases) { ...@@ -739,7 +739,7 @@ static PyObject *__Pyx_FindInheritedMetaclass(PyObject *bases) {
metatype = Py_TYPE(base); metatype = Py_TYPE(base);
#endif #endif
metaclass = __Pyx_CalculateMetaclass(metatype, bases); metaclass = __Pyx_CalculateMetaclass(metatype, bases);
#if !CYTHON_COMPILING_IN_CPYTHON #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
Py_DECREF(base); Py_DECREF(base);
#endif #endif
#if PY_MAJOR_VERSION < 3 #if PY_MAJOR_VERSION < 3
...@@ -923,7 +923,7 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { ...@@ -923,7 +923,7 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
/////////////// CallableCheck.proto /////////////// /////////////// CallableCheck.proto ///////////////
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_TYPE_SLOTS && PY_MAJOR_VERSION >= 3
#define __Pyx_PyCallable_Check(obj) ((obj)->ob_type->tp_call != NULL) #define __Pyx_PyCallable_Check(obj) ((obj)->ob_type->tp_call != NULL)
#else #else
#define __Pyx_PyCallable_Check(obj) PyCallable_Check(obj) #define __Pyx_PyCallable_Check(obj) PyCallable_Check(obj)
...@@ -996,7 +996,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*prot ...@@ -996,7 +996,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*prot
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
PyObject *result; PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON #if !CYTHON_AVOID_BORROWED_REFS
result = PyDict_GetItem($moddict_cname, name); result = PyDict_GetItem($moddict_cname, name);
if (likely(result)) { if (likely(result)) {
Py_INCREF(result); Py_INCREF(result);
...@@ -1062,7 +1062,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObj ...@@ -1062,7 +1062,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObj
/////////////// PyObjectGetAttrStr.proto /////////////// /////////////// PyObjectGetAttrStr.proto ///////////////
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
PyTypeObject* tp = Py_TYPE(obj); PyTypeObject* tp = Py_TYPE(obj);
if (likely(tp->tp_getattro)) if (likely(tp->tp_getattro))
...@@ -1079,7 +1079,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject ...@@ -1079,7 +1079,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject
/////////////// PyObjectSetAttrStr.proto /////////////// /////////////// PyObjectSetAttrStr.proto ///////////////
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
PyTypeObject* tp = Py_TYPE(obj); PyTypeObject* tp = Py_TYPE(obj);
...@@ -1155,7 +1155,7 @@ static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObje ...@@ -1155,7 +1155,7 @@ static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObje
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) {
PyObject *args, *result = NULL; PyObject *args, *result = NULL;
if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_ASSUME_SAFE_MACROS
args = PyTuple_New(1); args = PyTuple_New(1);
if (unlikely(!args)) goto bad; if (unlikely(!args)) goto bad;
Py_INCREF(self); Py_INCREF(self);
...@@ -1233,7 +1233,7 @@ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name ...@@ -1233,7 +1233,7 @@ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name
PyObject *method, *result = NULL; PyObject *method, *result = NULL;
method = __Pyx_PyObject_GetAttrStr(obj, method_name); method = __Pyx_PyObject_GetAttrStr(obj, method_name);
if (unlikely(!method)) goto bad; if (unlikely(!method)) goto bad;
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_UNPACK_METHODS
if (likely(PyMethod_Check(method))) { if (likely(PyMethod_Check(method))) {
PyObject *self = PyMethod_GET_SELF(method); PyObject *self = PyMethod_GET_SELF(method);
if (likely(self)) { if (likely(self)) {
...@@ -1263,7 +1263,7 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name ...@@ -1263,7 +1263,7 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
PyObject *method, *result = NULL; PyObject *method, *result = NULL;
method = __Pyx_PyObject_GetAttrStr(obj, method_name); method = __Pyx_PyObject_GetAttrStr(obj, method_name);
if (unlikely(!method)) goto bad; if (unlikely(!method)) goto bad;
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_UNPACK_METHODS
if (likely(PyMethod_Check(method))) { if (likely(PyMethod_Check(method))) {
PyObject *self = PyMethod_GET_SELF(method); PyObject *self = PyMethod_GET_SELF(method);
if (likely(self)) { if (likely(self)) {
...@@ -1302,7 +1302,7 @@ static PyObject* __Pyx_PyObject_CallMethod2(PyObject* obj, PyObject* method_name ...@@ -1302,7 +1302,7 @@ static PyObject* __Pyx_PyObject_CallMethod2(PyObject* obj, PyObject* method_name
static PyObject* __Pyx_PyObject_CallMethod2(PyObject* obj, PyObject* method_name, PyObject* arg1, PyObject* arg2) { static PyObject* __Pyx_PyObject_CallMethod2(PyObject* obj, PyObject* method_name, PyObject* arg1, PyObject* arg2) {
PyObject *args, *method, *result = NULL; PyObject *args, *method, *result = NULL;
method = __Pyx_PyObject_GetAttrStr(obj, method_name); method = __Pyx_PyObject_GetAttrStr(obj, method_name);
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_UNPACK_METHODS
if (likely(PyMethod_Check(method)) && likely(PyMethod_GET_SELF(method))) { if (likely(PyMethod_Check(method)) && likely(PyMethod_GET_SELF(method))) {
PyObject *self, *function; PyObject *self, *function;
self = PyMethod_GET_SELF(method); self = PyMethod_GET_SELF(method);
...@@ -1502,7 +1502,7 @@ static PyObject* __Pyx_PyNumber_InPlaceMatrixMultiply(PyObject* x, PyObject* y); ...@@ -1502,7 +1502,7 @@ static PyObject* __Pyx_PyNumber_InPlaceMatrixMultiply(PyObject* x, PyObject* y);
static PyObject* __Pyx_PyObject_CallMatrixMethod(PyObject* method, PyObject* arg) { static PyObject* __Pyx_PyObject_CallMatrixMethod(PyObject* method, PyObject* arg) {
// NOTE: eats the method reference // NOTE: eats the method reference
PyObject *result = NULL; PyObject *result = NULL;
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_UNPACK_METHODS
if (likely(PyMethod_Check(method))) { if (likely(PyMethod_Check(method))) {
PyObject *self = PyMethod_GET_SELF(method); PyObject *self = PyMethod_GET_SELF(method);
if (likely(self)) { if (likely(self)) {
......
...@@ -28,7 +28,7 @@ static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { ...@@ -28,7 +28,7 @@ static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
/////////////// ListAppend.proto /////////////// /////////////// ListAppend.proto ///////////////
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
PyListObject* L = (PyListObject*) list; PyListObject* L = (PyListObject*) list;
Py_ssize_t len = Py_SIZE(list); Py_ssize_t len = Py_SIZE(list);
...@@ -46,7 +46,7 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { ...@@ -46,7 +46,7 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
/////////////// ListCompAppend.proto /////////////// /////////////// ListCompAppend.proto ///////////////
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
PyListObject* L = (PyListObject*) list; PyListObject* L = (PyListObject*) list;
Py_ssize_t len = Py_SIZE(list); Py_ssize_t len = Py_SIZE(list);
...@@ -80,7 +80,7 @@ static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { ...@@ -80,7 +80,7 @@ static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L); /*proto*/ static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L); /*proto*/
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L); /*proto*/ static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L); /*proto*/
#define __Pyx_PyObject_Pop(L) (likely(PyList_CheckExact(L)) ? \ #define __Pyx_PyObject_Pop(L) (likely(PyList_CheckExact(L)) ? \
__Pyx_PyList_Pop(L) : __Pyx__PyObject_Pop(L)) __Pyx_PyList_Pop(L) : __Pyx__PyObject_Pop(L))
...@@ -94,15 +94,13 @@ static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L); /*proto*/ ...@@ -94,15 +94,13 @@ static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L); /*proto*/
//@requires: ObjectHandling.c::PyObjectCallMethod0 //@requires: ObjectHandling.c::PyObjectCallMethod0
static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) { static CYTHON_INLINE PyObject* __Pyx__PyObject_Pop(PyObject* L) {
#if CYTHON_COMPILING_IN_CPYTHON
if (Py_TYPE(L) == &PySet_Type) { if (Py_TYPE(L) == &PySet_Type) {
return PySet_Pop(L); return PySet_Pop(L);
} }
#endif
return __Pyx_PyObject_CallMethod0(L, PYIDENT("pop")); return __Pyx_PyObject_CallMethod0(L, PYIDENT("pop"));
} }
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) { static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) {
/* Check that both the size is positive and no reallocation shrinking needs to be done. */ /* Check that both the size is positive and no reallocation shrinking needs to be done. */
if (likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) { if (likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
...@@ -119,7 +117,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) { ...@@ -119,7 +117,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyList_Pop(PyObject* L) {
static PyObject* __Pyx__PyObject_PopNewIndex(PyObject* L, PyObject* py_ix); /*proto*/ static PyObject* __Pyx__PyObject_PopNewIndex(PyObject* L, PyObject* py_ix); /*proto*/
static PyObject* __Pyx__PyObject_PopIndex(PyObject* L, PyObject* py_ix); /*proto*/ static PyObject* __Pyx__PyObject_PopIndex(PyObject* L, PyObject* py_ix); /*proto*/
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static PyObject* __Pyx__PyList_PopIndex(PyObject* L, PyObject* py_ix, Py_ssize_t ix); /*proto*/ static PyObject* __Pyx__PyList_PopIndex(PyObject* L, PyObject* py_ix, Py_ssize_t ix); /*proto*/
#define __Pyx_PyObject_PopIndex(L, py_ix, ix, is_signed, type, to_py_func) ( \ #define __Pyx_PyObject_PopIndex(L, py_ix, ix, is_signed, type, to_py_func) ( \
...@@ -159,7 +157,7 @@ static PyObject* __Pyx__PyObject_PopIndex(PyObject* L, PyObject* py_ix) { ...@@ -159,7 +157,7 @@ static PyObject* __Pyx__PyObject_PopIndex(PyObject* L, PyObject* py_ix) {
return __Pyx_PyObject_CallMethod1(L, PYIDENT("pop"), py_ix); return __Pyx_PyObject_CallMethod1(L, PYIDENT("pop"), py_ix);
} }
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static PyObject* __Pyx__PyList_PopIndex(PyObject* L, PyObject* py_ix, Py_ssize_t ix) { static PyObject* __Pyx__PyList_PopIndex(PyObject* L, PyObject* py_ix, Py_ssize_t ix) {
Py_ssize_t size = PyList_GET_SIZE(L); Py_ssize_t size = PyList_GET_SIZE(L);
if (likely(size > (((PyListObject*)L)->allocated >> 1))) { if (likely(size > (((PyListObject*)L)->allocated >> 1))) {
...@@ -421,7 +419,7 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */ ...@@ -421,7 +419,7 @@ static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */
static double __Pyx__PyObject_AsDouble(PyObject* obj) { static double __Pyx__PyObject_AsDouble(PyObject* obj) {
PyObject* float_value; PyObject* float_value;
#if CYTHON_COMPILING_IN_PYPY #if !CYTHON_USE_TYPE_SLOTS
float_value = PyNumber_Float(obj); if (0) goto bad; float_value = PyNumber_Float(obj); if (0) goto bad;
#else #else
PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number; PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
...@@ -471,7 +469,7 @@ static PyObject* __Pyx__PyNumber_PowerOf2(PyObject *two, PyObject *exp, PyObject ...@@ -471,7 +469,7 @@ static PyObject* __Pyx__PyNumber_PowerOf2(PyObject *two, PyObject *exp, PyObject
static PyObject* __Pyx__PyNumber_PowerOf2(PyObject *two, PyObject *exp, PyObject *none, int inplace) { static PyObject* __Pyx__PyNumber_PowerOf2(PyObject *two, PyObject *exp, PyObject *none, int inplace) {
// in CPython, 1<<N is substantially faster than 2**N // in CPython, 1<<N is substantially faster than 2**N
// see http://bugs.python.org/issue21420 // see http://bugs.python.org/issue21420
#if CYTHON_COMPILING_IN_CPYTHON #if !CYTHON_COMPILING_IN_PYPY
Py_ssize_t shiftby; Py_ssize_t shiftby;
#if PY_MAJOR_VERSION < 3 #if PY_MAJOR_VERSION < 3
if (likely(PyInt_CheckExact(exp))) { if (likely(PyInt_CheckExact(exp))) {
...@@ -520,7 +518,7 @@ fallback: ...@@ -520,7 +518,7 @@ fallback:
/////////////// PyIntBinop.proto /////////////// /////////////// PyIntBinop.proto ///////////////
#if CYTHON_COMPILING_IN_CPYTHON #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_{{op}}{{order}}(PyObject *op1, PyObject *op2, long intval, int inplace); /*proto*/ static PyObject* __Pyx_PyInt_{{op}}{{order}}(PyObject *op1, PyObject *op2, long intval, int inplace); /*proto*/
#else #else
#define __Pyx_PyInt_{{op}}{{order}}(op1, op2, intval, inplace) \ #define __Pyx_PyInt_{{op}}{{order}}(op1, op2, intval, inplace) \
...@@ -531,7 +529,7 @@ static PyObject* __Pyx_PyInt_{{op}}{{order}}(PyObject *op1, PyObject *op2, long ...@@ -531,7 +529,7 @@ static PyObject* __Pyx_PyInt_{{op}}{{order}}(PyObject *op1, PyObject *op2, long
/////////////// PyIntBinop /////////////// /////////////// PyIntBinop ///////////////
#if CYTHON_COMPILING_IN_CPYTHON #if !CYTHON_COMPILING_IN_PYPY
{{py: from Cython.Utility import pylong_join }} {{py: from Cython.Utility import pylong_join }}
{{py: pyval, ival = ('op2', 'b') if order == 'CObj' else ('op1', 'a') }} {{py: pyval, ival = ('op2', 'b') if order == 'CObj' else ('op1', 'a') }}
{{py: slot_name = {'TrueDivide': 'true_divide', 'FloorDivide': 'floor_divide'}.get(op, op.lower()) }} {{py: slot_name = {'TrueDivide': 'true_divide', 'FloorDivide': 'floor_divide'}.get(op, op.lower()) }}
...@@ -733,7 +731,7 @@ static PyObject* __Pyx_PyInt_{{op}}{{order}}(PyObject *op1, PyObject *op2, CYTHO ...@@ -733,7 +731,7 @@ static PyObject* __Pyx_PyInt_{{op}}{{order}}(PyObject *op1, PyObject *op2, CYTHO
/////////////// PyFloatBinop.proto /////////////// /////////////// PyFloatBinop.proto ///////////////
#if CYTHON_COMPILING_IN_CPYTHON #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_{{op}}{{order}}(PyObject *op1, PyObject *op2, double floatval, int inplace); /*proto*/ static PyObject* __Pyx_PyFloat_{{op}}{{order}}(PyObject *op1, PyObject *op2, double floatval, int inplace); /*proto*/
#else #else
#define __Pyx_PyFloat_{{op}}{{order}}(op1, op2, floatval, inplace) \ #define __Pyx_PyFloat_{{op}}{{order}}(op1, op2, floatval, inplace) \
...@@ -745,7 +743,7 @@ static PyObject* __Pyx_PyFloat_{{op}}{{order}}(PyObject *op1, PyObject *op2, dou ...@@ -745,7 +743,7 @@ static PyObject* __Pyx_PyFloat_{{op}}{{order}}(PyObject *op1, PyObject *op2, dou
/////////////// PyFloatBinop /////////////// /////////////// PyFloatBinop ///////////////
#if CYTHON_COMPILING_IN_CPYTHON #if !CYTHON_COMPILING_IN_PYPY
{{py: from Cython.Utility import pylong_join }} {{py: from Cython.Utility import pylong_join }}
{{py: pyval, fval = ('op2', 'b') if order == 'CObj' else ('op1', 'a') }} {{py: pyval, fval = ('op2', 'b') if order == 'CObj' else ('op1', 'a') }}
{{py: {{py:
......
...@@ -552,7 +552,7 @@ static int __Pyx_PyUnicode_Tailmatch(PyObject* s, PyObject* substr, ...@@ -552,7 +552,7 @@ static int __Pyx_PyUnicode_Tailmatch(PyObject* s, PyObject* substr,
Py_ssize_t i, count = PyTuple_GET_SIZE(substr); Py_ssize_t i, count = PyTuple_GET_SIZE(substr);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
Py_ssize_t result; Py_ssize_t result;
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
result = PyUnicode_Tailmatch(s, PyTuple_GET_ITEM(substr, i), result = PyUnicode_Tailmatch(s, PyTuple_GET_ITEM(substr, i),
start, end, direction); start, end, direction);
#else #else
...@@ -642,7 +642,7 @@ static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr, ...@@ -642,7 +642,7 @@ static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr,
Py_ssize_t i, count = PyTuple_GET_SIZE(substr); Py_ssize_t i, count = PyTuple_GET_SIZE(substr);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
int result; int result;
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
result = __Pyx_PyBytes_SingleTailmatch(self, PyTuple_GET_ITEM(substr, i), result = __Pyx_PyBytes_SingleTailmatch(self, PyTuple_GET_ITEM(substr, i),
start, end, direction); start, end, direction);
#else #else
...@@ -815,7 +815,7 @@ static CYTHON_INLINE int __Pyx_PyByteArray_Append(PyObject* bytearray, int value ...@@ -815,7 +815,7 @@ static CYTHON_INLINE int __Pyx_PyByteArray_Append(PyObject* bytearray, int value
//////////////////// PyObjectFormatSimple.proto //////////////////// //////////////////// PyObjectFormatSimple.proto ////////////////////
#if !CYTHON_COMPILING_IN_CPYTHON #if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyObject_FormatSimple(s, f) ( \ #define __Pyx_PyObject_FormatSimple(s, f) ( \
likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) : \ likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) : \
PyObject_Format(s, f)) PyObject_Format(s, f))
......
...@@ -86,7 +86,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); ...@@ -86,7 +86,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else #else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
...@@ -397,7 +397,7 @@ static {{struct_type_decl}} {{funcname}}(PyObject * o) { ...@@ -397,7 +397,7 @@ static {{struct_type_decl}} {{funcname}}(PyObject * o) {
goto bad; goto bad;
} }
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
{{for ix, component in enumerate(components):}} {{for ix, component in enumerate(components):}}
{{py:attr = "result.f%s" % ix}} {{py:attr = "result.f%s" % ix}}
{{attr}} = {{component.from_py_function}}(PyTuple_GET_ITEM(o, {{ix}})); {{attr}} = {{component.from_py_function}}(PyTuple_GET_ITEM(o, {{ix}}));
...@@ -651,7 +651,7 @@ static PyObject* __Pyx_PyUnicode_Build(Py_ssize_t ulength, char* chars, int clen ...@@ -651,7 +651,7 @@ static PyObject* __Pyx_PyUnicode_Build(Py_ssize_t ulength, char* chars, int clen
int prepend_sign, char padding_char) { int prepend_sign, char padding_char) {
PyObject *uval; PyObject *uval;
Py_ssize_t uoffset = ulength - clength; Py_ssize_t uoffset = ulength - clength;
#if CYTHON_COMPILING_IN_CPYTHON #if CYTHON_USE_UNICODE_INTERNALS
Py_ssize_t i; Py_ssize_t i;
#if CYTHON_PEP393_ENABLED #if CYTHON_PEP393_ENABLED
// Py 3.3+ (post PEP-393) // Py 3.3+ (post PEP-393)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment