aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/cython/Cython/Utility/CythonFunction.c
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:39 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:39 +0300
commite9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch)
tree64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/tools/cython/Cython/Utility/CythonFunction.c
parent2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff)
downloadydb-e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/cython/Cython/Utility/CythonFunction.c')
-rw-r--r--contrib/tools/cython/Cython/Utility/CythonFunction.c220
1 files changed, 110 insertions, 110 deletions
diff --git a/contrib/tools/cython/Cython/Utility/CythonFunction.c b/contrib/tools/cython/Cython/Utility/CythonFunction.c
index f2bd802e27..d51b308a8d 100644
--- a/contrib/tools/cython/Cython/Utility/CythonFunction.c
+++ b/contrib/tools/cython/Cython/Utility/CythonFunction.c
@@ -1,5 +1,5 @@
-//////////////////// CythonFunctionShared.proto ////////////////////
+//////////////////// CythonFunctionShared.proto ////////////////////
#define __Pyx_CyFunction_USED 1
@@ -36,7 +36,7 @@ typedef struct {
// Dynamic default args and annotations
void *defaults;
int defaults_pyobjects;
- size_t defaults_size; // used by FusedFunction for copying defaults
+ size_t defaults_size; // used by FusedFunction for copying defaults
int flags;
// Defaults info
@@ -50,7 +50,7 @@ static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
-static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
+static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
int flags, PyObject* qualname,
PyObject *self,
PyObject *module, PyObject *globals,
@@ -69,8 +69,8 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
static int __pyx_CyFunction_init(void);
-
-//////////////////// CythonFunctionShared ////////////////////
+
+//////////////////// CythonFunctionShared ////////////////////
//@substitute: naming
//@requires: CommonStructures.c::FetchCommonType
////@requires: ObjectHandling.c::PyObjectGetAttrStr
@@ -426,8 +426,8 @@ static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
- Py_INCREF(m->func_qualname);
- return m->func_qualname;
+ Py_INCREF(m->func_qualname);
+ return m->func_qualname;
#else
return PyString_FromString(m->func.m_ml->ml_name);
#endif
@@ -445,9 +445,9 @@ static PyMethodDef __pyx_CyFunction_methods[] = {
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
-static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
- PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
- if (unlikely(op == NULL))
+static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
+ PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
+ if (unlikely(op == NULL))
return NULL;
op->flags = flags;
__Pyx_CyFunction_weakreflist(op) = NULL;
@@ -469,7 +469,7 @@ static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *
op->func_code = code;
// Dynamic Default args
op->defaults_pyobjects = 0;
- op->defaults_size = 0;
+ op->defaults_size = 0;
op->defaults = NULL;
op->defaults_tuple = NULL;
op->defaults_kwdict = NULL;
@@ -550,7 +550,7 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit,
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
-#if PY_MAJOR_VERSION < 3
+#if PY_MAJOR_VERSION < 3
__pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
@@ -566,7 +566,7 @@ static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObj
if (obj == Py_None)
obj = NULL;
-#endif
+#endif
return __Pyx_PyMethod_New(func, obj, type);
}
@@ -731,15 +731,15 @@ static PyTypeObject __pyx_CyFunctionType_type = {
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
-#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
+#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
0, /*tp_vectorcall*/
#endif
-#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
+#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
0, /*tp_print*/
#endif
-#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
- 0, /*tp_pypy_flags*/
-#endif
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
+ 0, /*tp_pypy_flags*/
+#endif
};
@@ -759,7 +759,7 @@ static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t
return PyErr_NoMemory();
memset(m->defaults, 0, size);
m->defaults_pyobjects = pyobjects;
- m->defaults_size = size;
+ m->defaults_size = size;
return m->defaults;
}
@@ -781,36 +781,36 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py
Py_INCREF(dict);
}
-
-//////////////////// CythonFunction.proto ////////////////////
-
-static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
- int flags, PyObject* qualname,
- PyObject *closure,
- PyObject *module, PyObject *globals,
- PyObject* code);
-
-//////////////////// CythonFunction ////////////////////
-//@requires: CythonFunctionShared
-
-static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
- PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
- PyObject *op = __Pyx_CyFunction_Init(
- PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
- ml, flags, qualname, closure, module, globals, code
- );
- if (likely(op)) {
- PyObject_GC_Track(op);
- }
- return op;
-}
-
-
+
+//////////////////// CythonFunction.proto ////////////////////
+
+static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
+ int flags, PyObject* qualname,
+ PyObject *closure,
+ PyObject *module, PyObject *globals,
+ PyObject* code);
+
+//////////////////// CythonFunction ////////////////////
+//@requires: CythonFunctionShared
+
+static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
+ PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
+ PyObject *op = __Pyx_CyFunction_Init(
+ PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
+ ml, flags, qualname, closure, module, globals, code
+ );
+ if (likely(op)) {
+ PyObject_GC_Track(op);
+ }
+ return op;
+}
+
+
//////////////////// CyFunctionClassCell.proto ////////////////////
static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj);/*proto*/
//////////////////// CyFunctionClassCell ////////////////////
-//@requires: CythonFunctionShared
+//@requires: CythonFunctionShared
static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj) {
Py_ssize_t i, count = PyList_GET_SIZE(cyfunctions);
@@ -833,9 +833,9 @@ static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *class
return 0;
}
-
+
//////////////////// FusedFunction.proto ////////////////////
-
+
typedef struct {
__pyx_CyFunctionObject func;
PyObject *__signatures__;
@@ -843,8 +843,8 @@ typedef struct {
PyObject *self;
} __pyx_FusedFunctionObject;
-static PyObject *__pyx_FusedFunction_New(PyMethodDef *ml, int flags,
- PyObject *qualname, PyObject *closure,
+static PyObject *__pyx_FusedFunction_New(PyMethodDef *ml, int flags,
+ PyObject *qualname, PyObject *closure,
PyObject *module, PyObject *globals,
PyObject *code);
@@ -855,27 +855,27 @@ static int __pyx_FusedFunction_init(void);
#define __Pyx_FusedFunction_USED
//////////////////// FusedFunction ////////////////////
-//@requires: CythonFunctionShared
+//@requires: CythonFunctionShared
static PyObject *
-__pyx_FusedFunction_New(PyMethodDef *ml, int flags,
- PyObject *qualname, PyObject *closure,
+__pyx_FusedFunction_New(PyMethodDef *ml, int flags,
+ PyObject *qualname, PyObject *closure,
PyObject *module, PyObject *globals,
PyObject *code)
{
- PyObject *op = __Pyx_CyFunction_Init(
- // __pyx_CyFunctionObject is correct below since that's the cast that we want.
- PyObject_GC_New(__pyx_CyFunctionObject, __pyx_FusedFunctionType),
- ml, flags, qualname, closure, module, globals, code
- );
- if (likely(op)) {
- __pyx_FusedFunctionObject *fusedfunc = (__pyx_FusedFunctionObject *) op;
- fusedfunc->__signatures__ = NULL;
- fusedfunc->type = NULL;
- fusedfunc->self = NULL;
- PyObject_GC_Track(op);
- }
- return op;
+ PyObject *op = __Pyx_CyFunction_Init(
+ // __pyx_CyFunctionObject is correct below since that's the cast that we want.
+ PyObject_GC_New(__pyx_CyFunctionObject, __pyx_FusedFunctionType),
+ ml, flags, qualname, closure, module, globals, code
+ );
+ if (likely(op)) {
+ __pyx_FusedFunctionObject *fusedfunc = (__pyx_FusedFunctionObject *) op;
+ fusedfunc->__signatures__ = NULL;
+ fusedfunc->type = NULL;
+ fusedfunc->self = NULL;
+ PyObject_GC_Track(op);
+ }
+ return op;
}
static void
@@ -925,7 +925,7 @@ __pyx_FusedFunction_descr_get(PyObject *self, PyObject *obj, PyObject *type)
if (obj == Py_None)
obj = NULL;
- meth = (__pyx_FusedFunctionObject *) __pyx_FusedFunction_New(
+ meth = (__pyx_FusedFunctionObject *) __pyx_FusedFunction_New(
((PyCFunctionObject *) func)->m_ml,
((__pyx_CyFunctionObject *) func)->flags,
((__pyx_CyFunctionObject *) func)->func_qualname,
@@ -936,26 +936,26 @@ __pyx_FusedFunction_descr_get(PyObject *self, PyObject *obj, PyObject *type)
if (!meth)
return NULL;
- // defaults needs copying fully rather than just copying the pointer
- // since otherwise it will be freed on destruction of meth despite
- // belonging to func rather than meth
- if (func->func.defaults) {
- PyObject **pydefaults;
- int i;
-
- if (!__Pyx_CyFunction_InitDefaults((PyObject*)meth,
- func->func.defaults_size,
- func->func.defaults_pyobjects)) {
- Py_XDECREF((PyObject*)meth);
- return NULL;
- }
- memcpy(meth->func.defaults, func->func.defaults, func->func.defaults_size);
-
- pydefaults = __Pyx_CyFunction_Defaults(PyObject *, meth);
- for (i = 0; i < meth->func.defaults_pyobjects; i++)
- Py_XINCREF(pydefaults[i]);
- }
-
+ // defaults needs copying fully rather than just copying the pointer
+ // since otherwise it will be freed on destruction of meth despite
+ // belonging to func rather than meth
+ if (func->func.defaults) {
+ PyObject **pydefaults;
+ int i;
+
+ if (!__Pyx_CyFunction_InitDefaults((PyObject*)meth,
+ func->func.defaults_size,
+ func->func.defaults_pyobjects)) {
+ Py_XDECREF((PyObject*)meth);
+ return NULL;
+ }
+ memcpy(meth->func.defaults, func->func.defaults, func->func.defaults_size);
+
+ pydefaults = __Pyx_CyFunction_Defaults(PyObject *, meth);
+ for (i = 0; i < meth->func.defaults_pyobjects; i++)
+ Py_XINCREF(pydefaults[i]);
+ }
+
Py_XINCREF(func->func.func_classobj);
meth->func.func_classobj = func->func.func_classobj;
@@ -1004,29 +1004,29 @@ __pyx_FusedFunction_getitem(__pyx_FusedFunctionObject *self, PyObject *idx)
PyObject *sep = NULL;
int i;
- if (unlikely(!list))
+ if (unlikely(!list))
return NULL;
for (i = 0; i < n; i++) {
- int ret;
- PyObject *string;
+ int ret;
+ PyObject *string;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
PyObject *item = PyTuple_GET_ITEM(idx, i);
#else
- PyObject *item = PySequence_ITEM(idx, i); if (unlikely(!item)) goto __pyx_err;
+ PyObject *item = PySequence_ITEM(idx, i); if (unlikely(!item)) goto __pyx_err;
#endif
string = _obj_to_str(item);
#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
Py_DECREF(item);
#endif
- if (unlikely(!string)) goto __pyx_err;
- ret = PyList_Append(list, string);
+ if (unlikely(!string)) goto __pyx_err;
+ ret = PyList_Append(list, string);
Py_DECREF(string);
- if (unlikely(ret < 0)) goto __pyx_err;
+ if (unlikely(ret < 0)) goto __pyx_err;
}
sep = PyUnicode_FromString("|");
- if (likely(sep))
+ if (likely(sep))
signature = PyUnicode_Join(sep, list);
__pyx_err:
;
@@ -1140,7 +1140,7 @@ __pyx_FusedFunction_call(PyObject *func, PyObject *args, PyObject *kw)
PyErr_Format(PyExc_TypeError,
"First argument should be of type %.200s, got %.200s.",
((PyTypeObject *) binding_func->type)->tp_name,
- Py_TYPE(self)->tp_name);
+ Py_TYPE(self)->tp_name);
goto bad;
} else if (unlikely(is_instance == -1)) {
goto bad;
@@ -1242,7 +1242,7 @@ static PyTypeObject __pyx_FusedFunctionType_type = {
// __doc__ is None for the fused function type, but we need it to be
// a descriptor for the instance's __doc__, so rebuild descriptors in our subclass
__pyx_CyFunction_getsets, /*tp_getset*/
- // NOTE: tp_base may be changed later during module initialisation when importing CyFunction across modules.
+ // NOTE: tp_base may be changed later during module initialisation when importing CyFunction across modules.
&__pyx_CyFunctionType_type, /*tp_base*/
0, /*tp_dict*/
__pyx_FusedFunction_descr_get, /*tp_descr_get*/
@@ -1263,20 +1263,20 @@ static PyTypeObject __pyx_FusedFunctionType_type = {
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
-#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
+#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
0, /*tp_vectorcall*/
#endif
-#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
- 0, /*tp_print*/
+#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
+ 0, /*tp_print*/
+#endif
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
+ 0, /*tp_pypy_flags*/
#endif
-#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
- 0, /*tp_pypy_flags*/
-#endif
};
static int __pyx_FusedFunction_init(void) {
- // Set base from __Pyx_FetchCommonTypeFromSpec, in case it's different from the local static value.
- __pyx_FusedFunctionType_type.tp_base = __pyx_CyFunctionType;
+ // Set base from __Pyx_FetchCommonTypeFromSpec, in case it's different from the local static value.
+ __pyx_FusedFunctionType_type.tp_base = __pyx_CyFunctionType;
__pyx_FusedFunctionType = __Pyx_FetchCommonType(&__pyx_FusedFunctionType_type);
if (__pyx_FusedFunctionType == NULL) {
return -1;
@@ -1302,8 +1302,8 @@ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
// special C-API function only in Pyston and PyPy >= 5.9
if (PyMethodDescr_Check(method))
#else
- #if PY_MAJOR_VERSION == 2
- // PyMethodDescr_Type is not exposed in the CPython C-API in Py2.
+ #if PY_MAJOR_VERSION == 2
+ // PyMethodDescr_Type is not exposed in the CPython C-API in Py2.
static PyTypeObject *methoddescr_type = NULL;
if (methoddescr_type == NULL) {
PyObject *meth = PyObject_GetAttrString((PyObject*)&PyList_Type, "append");
@@ -1311,9 +1311,9 @@ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
methoddescr_type = Py_TYPE(meth);
Py_DECREF(meth);
}
- #else
- PyTypeObject *methoddescr_type = &PyMethodDescr_Type;
- #endif
+ #else
+ PyTypeObject *methoddescr_type = &PyMethodDescr_Type;
+ #endif
if (__Pyx_TypeCheck(method, methoddescr_type))
#endif
{
@@ -1331,7 +1331,7 @@ static PyObject* __Pyx_Method_ClassMethod(PyObject *method) {
// python classes
return PyClassMethod_New(PyMethod_GET_FUNCTION(method));
}
- else {
+ else {
return PyClassMethod_New(method);
}
}