From: Anthony Geay Date: Mon, 2 Mar 2015 11:28:01 +0000 (+0100) Subject: First test OK for DataArrayDouble. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5ee69ad26ea78f94a37f3f63f8f22fbfc8b19606;p=tools%2Fmedcoupling.git First test OK for DataArrayDouble. --- diff --git a/src/MEDCoupling_Swig/MEDCouplingMemArray.i b/src/MEDCoupling_Swig/MEDCouplingMemArray.i index 4aefb7327..d7ec98b1d 100644 --- a/src/MEDCoupling_Swig/MEDCouplingMemArray.i +++ b/src/MEDCoupling_Swig/MEDCouplingMemArray.i @@ -2182,12 +2182,20 @@ namespace ParaMEDMEM static const char MSG[]="DataArrayDouble.__new__ : the args in input is expected to be a tuple of size 2 !"; if(!PyTuple_Check(args)) throw INTERP_KERNEL::Exception(MSG); - PyObject *globals(PyEval_GetGlobals());//borrowed - PyObject *builtins(PyDict_GetItemString(globals,"__builtins__"));//borrowed - PyObject *obj(PyObject_GetAttrString(builtins,"object")); + //PyObject *globals(PyEval_GetGlobals());//borrowed + //PyObject *builtins(PyDict_GetItemString(globals,"__builtins__"));//borrowed + //PyObject *builtinsd(PyModule_GetDict(builtins));//borrowed + PyObject *builtinsd(PyEval_GetBuiltins());//borrowed + PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed + //PyObject *obj(PyObject_GetAttrString(builtins,"object")); PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__")); - Py_DECREF(obj); - PyObject *instance(PyObject_CallObject(selfMeth,PyTuple_GetItem(args,0))); + //Py_DECREF(obj); + ///// + PyObject *tmp0(PyTuple_New(1)); + PyTuple_SetItem(tmp0,0,PyTuple_GetItem(args,0)); Py_DECREF(PyTuple_GetItem(args,0)); + PyObject *instance(PyObject_CallObject(selfMeth,tmp0)); + Py_DECREF(tmp0); + ///// Py_DECREF(selfMeth); PyObject *initMeth(PyObject_GetAttrString(instance,"__init__")); if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)))