Commit 96bf6bc8 authored by Stefan Behnel's avatar Stefan Behnel

code cleanup

parent b363f41b
...@@ -7503,13 +7503,12 @@ requires = [find_py2_metaclass_utility_code]) ...@@ -7503,13 +7503,12 @@ requires = [find_py2_metaclass_utility_code])
create_py3class_utility_code = UtilityCode( create_py3class_utility_code = UtilityCode(
proto = """ proto = """
static PyObject *__Pyx_Py3MetaclassGet(PyObject *bases, PyObject *mkw); static PyObject *__Pyx_Py3MetaclassGet(PyObject *bases, PyObject *mkw); /*proto*/
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *mkw, PyObject *modname, PyObject *doc); static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *mkw, PyObject *modname, PyObject *doc); /*proto*/
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw); static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw); /*proto*/
""", """,
impl = """ impl = """
PyObject *__Pyx_Py3MetaclassGet(PyObject *bases, PyObject *mkw) PyObject *__Pyx_Py3MetaclassGet(PyObject *bases, PyObject *mkw) {
{
PyObject *metaclass = PyDict_GetItemString(mkw, "metaclass"); PyObject *metaclass = PyDict_GetItemString(mkw, "metaclass");
if (metaclass) { if (metaclass) {
Py_INCREF(metaclass); Py_INCREF(metaclass);
...@@ -7522,15 +7521,15 @@ PyObject *__Pyx_Py3MetaclassGet(PyObject *bases, PyObject *mkw) ...@@ -7522,15 +7521,15 @@ PyObject *__Pyx_Py3MetaclassGet(PyObject *bases, PyObject *mkw)
return __Pyx_FindPy2Metaclass(bases); return __Pyx_FindPy2Metaclass(bases);
} }
PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *mkw, PyObject *modname, PyObject *doc) PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *mkw,
{ PyObject *modname, PyObject *doc) {
PyObject *prep; PyObject *prep;
PyObject *pargs; PyObject *pargs;
PyObject *ns; PyObject *ns;
PyObject *str; PyObject *str;
prep = PyObject_GetAttrString(metaclass, "__prepare__"); prep = PyObject_GetAttrString(metaclass, "__prepare__");
if (prep == NULL) { if (!prep) {
if (!PyErr_ExceptionMatches(PyExc_AttributeError)) if (!PyErr_ExceptionMatches(PyExc_AttributeError))
return NULL; return NULL;
PyErr_Clear(); PyErr_Clear();
...@@ -7547,7 +7546,7 @@ PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObje ...@@ -7547,7 +7546,7 @@ PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObje
PyTuple_SET_ITEM(pargs, 0, name); PyTuple_SET_ITEM(pargs, 0, name);
PyTuple_SET_ITEM(pargs, 1, bases); PyTuple_SET_ITEM(pargs, 1, bases);
ns = PyEval_CallObjectWithKeywords(prep, pargs, mkw); ns = PyObject_Call(prep, pargs, mkw);
Py_DECREF(prep); Py_DECREF(prep);
Py_DECREF(pargs); Py_DECREF(pargs);
...@@ -7593,8 +7592,7 @@ PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObje ...@@ -7593,8 +7592,7 @@ PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObje
return ns; return ns;
} }
PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw) PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw) {
{
PyObject *result; PyObject *result;
PyObject *margs = PyTuple_New(3); PyObject *margs = PyTuple_New(3);
if (!margs) if (!margs)
...@@ -7605,7 +7603,7 @@ PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *ba ...@@ -7605,7 +7603,7 @@ PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *ba
PyTuple_SET_ITEM(margs, 0, name); PyTuple_SET_ITEM(margs, 0, name);
PyTuple_SET_ITEM(margs, 1, bases); PyTuple_SET_ITEM(margs, 1, bases);
PyTuple_SET_ITEM(margs, 2, dict); PyTuple_SET_ITEM(margs, 2, dict);
result = PyEval_CallObjectWithKeywords(metaclass, margs, mkw); result = PyObject_Call(metaclass, margs, mkw);
Py_DECREF(margs); Py_DECREF(margs);
return result; return result;
} }
......
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