From 2c0c1639a1d5d230e6db77204dae0c8e963f5623 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Mon, 8 Nov 2010 19:21:44 +0100 Subject: [PATCH] Py2.3 fix --- Cython/Compiler/ExprNodes.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 92963ffd..48b48bad 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -7202,11 +7202,15 @@ static int __Pyx_PrepareClass(PyObject *metaclass, PyObject *bases, PyObject *na PyErr_Clear(); return 0; } - pargs = PyTuple_Pack(2, name, bases); - if (pargs == NULL) { + pargs = PyTuple_New(2); + if (!pargs) { Py_DECREF(prep); return -1; } + Py_INCREF(name); + Py_INCREF(bases); + PyTuple_SET_ITEM(pargs, 0, name); + PyTuple_SET_ITEM(pargs, 1, bases); ns = PyEval_CallObjectWithKeywords(prep, pargs, mkw); Py_DECREF(pargs); Py_DECREF(prep); @@ -7271,8 +7275,13 @@ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *na Py_INCREF(metaclass); } if (mkw && PyDict_Size(mkw) > 0) { - PyObject *margs; - margs = PyTuple_Pack(3, name, bases, dict, NULL); + PyObject *margs = PyTuple_New(3); + Py_INCREF(name); + Py_INCREF(bases); + Py_INCREF(dict); + PyTuple_SET_ITEM(margs, 0, name); + PyTuple_SET_ITEM(margs, 1, bases); + PyTuple_SET_ITEM(margs, 2, dict); result = PyEval_CallObjectWithKeywords(metaclass, margs, mkw); Py_DECREF(margs); } else { -- 2.26.2