Commit a1aa7ba8 authored by Stefan Behnel's avatar Stefan Behnel

Remove a macro from helper code that I find difficult to read. The result is...

Remove a macro from helper code that I find difficult to read. The result is not perfect, but at least it's more visible what get's assigned to what.
parent aaf573c3
...@@ -60,9 +60,6 @@ static int __Pyx_setup_reduce(PyObject* type_obj); ...@@ -60,9 +60,6 @@ static int __Pyx_setup_reduce(PyObject* type_obj);
//@requires: ObjectHandling.c::PyObjectGetAttrStr //@requires: ObjectHandling.c::PyObjectGetAttrStr
//@substitute: naming //@substitute: naming
#define __Pyx_setup_reduce_GET_ATTR_OR_BAD(res, obj, name) \
res = __Pyx_PyObject_GetAttrStr(obj, name); if (unlikely(!res)) goto BAD;
static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
int ret; int ret;
PyObject *name_attr; PyObject *name_attr;
...@@ -98,25 +95,25 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { ...@@ -98,25 +95,25 @@ static int __Pyx_setup_reduce(PyObject* type_obj) {
if (unlikely(!object_reduce_ex)) { if (unlikely(!object_reduce_ex)) {
Py_CLEAR(object_reduce); Py_CLEAR(object_reduce);
__Pyx_setup_reduce_GET_ATTR_OR_BAD(builtin_object, $builtins_cname, PYIDENT("object")); builtin_object = __Pyx_PyObject_GetAttrStr($builtins_cname, PYIDENT("object")); if (!builtin_object) goto BAD;
__Pyx_setup_reduce_GET_ATTR_OR_BAD(object_reduce, builtin_object, PYIDENT("__reduce__")); object_reduce = __Pyx_PyObject_GetAttrStr(builtin_object, PYIDENT("__reduce__")); if (!object_reduce) goto BAD;
__Pyx_setup_reduce_GET_ATTR_OR_BAD(object_reduce_ex, builtin_object, PYIDENT("__reduce_ex__")); object_reduce_ex = __Pyx_PyObject_GetAttrStr(builtin_object, PYIDENT("__reduce_ex__")); if (!object_reduce_ex) goto BAD;
} }
__Pyx_setup_reduce_GET_ATTR_OR_BAD(reduce_ex, type_obj, PYIDENT("__reduce_ex__")); reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, PYIDENT("__reduce_ex__")); if (unlikely(!reduce_ex)) goto BAD;
if (reduce_ex == object_reduce_ex) { if (reduce_ex == object_reduce_ex) {
__Pyx_setup_reduce_GET_ATTR_OR_BAD(reduce, type_obj, PYIDENT("__reduce__")); reduce = __Pyx_PyObject_GetAttrStr(type_obj, PYIDENT("__reduce__")); if (unlikely(!reduce)) goto BAD;
if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, PYIDENT("__reduce_cython__"))) { if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, PYIDENT("__reduce_cython__"))) {
__Pyx_setup_reduce_GET_ATTR_OR_BAD(reduce_cython, type_obj, PYIDENT("__reduce_cython__")); reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, PYIDENT("__reduce_cython__")); if (unlikely(!reduce_cython)) goto BAD;
ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, PYIDENT("__reduce__"), reduce_cython); if (ret < 0) goto BAD; ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, PYIDENT("__reduce__"), reduce_cython); if (unlikely(ret < 0)) goto BAD;
ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, PYIDENT("__reduce_cython__")); if (ret < 0) goto BAD; ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, PYIDENT("__reduce_cython__")); if (unlikely(ret < 0)) goto BAD;
setstate = __Pyx_PyObject_GetAttrStr(type_obj, PYIDENT("__setstate__")); setstate = __Pyx_PyObject_GetAttrStr(type_obj, PYIDENT("__setstate__"));
if (!setstate) PyErr_Clear(); if (!setstate) PyErr_Clear();
if (!setstate || __Pyx_setup_reduce_is_named(setstate, PYIDENT("__setstate_cython__"))) { if (!setstate || __Pyx_setup_reduce_is_named(setstate, PYIDENT("__setstate_cython__"))) {
__Pyx_setup_reduce_GET_ATTR_OR_BAD(setstate_cython, type_obj, PYIDENT("__setstate_cython__")); setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, PYIDENT("__setstate_cython__")); if (unlikely(!setstate_cython)) goto BAD;
ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, PYIDENT("__setstate__"), setstate_cython); if (ret < 0) goto BAD; ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, PYIDENT("__setstate__"), setstate_cython); if (unlikely(ret < 0)) goto BAD;
ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, PYIDENT("__setstate_cython__")); if (ret < 0) goto BAD; ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, PYIDENT("__setstate_cython__")); if (unlikely(ret < 0)) goto BAD;
} }
PyType_Modified((PyTypeObject*)type_obj); PyType_Modified((PyTypeObject*)type_obj);
} }
......
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