X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FDSC%2FDSC_Python%2Fcalcium.i;h=586cd8defdd6bc4a78a95135c6c8db65de76c9dd;hb=4b14a3f48efda72f90b88c78c6ae02153631dfd6;hp=61eed80b8d65f6b1cd98165db489872cfb010622;hpb=a63265d524e8436588a7bb82147a69812c153b1b;p=modules%2Fkernel.git diff --git a/src/DSC/DSC_Python/calcium.i b/src/DSC/DSC_Python/calcium.i index 61eed80b8..586cd8def 100644 --- a/src/DSC/DSC_Python/calcium.i +++ b/src/DSC/DSC_Python/calcium.i @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -66,8 +66,8 @@ struct omniORBpyAPI { %init %{ +#include // init section - #ifdef WITH_NUMPY import_array() #endif @@ -77,10 +77,10 @@ struct omniORBpyAPI { { PyErr_SetString(PyExc_ImportError, (char*)"Cannot import _omnipy"); - return; + return NULL; } PyObject* pyapi = PyObject_GetAttrString(omnipy, (char*)"API"); - api = (omniORBpyAPI*)PyCObject_AsVoidPtr(pyapi); + api = (omniORBpyAPI*)PyCapsule_New(pyapi,NULL,NULL); Py_DECREF(pyapi); PyObject* engines = PyImport_ImportModule("Engines"); @@ -142,9 +142,11 @@ const char* pytype_string(PyObject* py_obj) { if (PyDict_Check( py_obj)) return "dict" ; if (PyList_Check( py_obj)) return "list" ; if (PyTuple_Check( py_obj)) return "tuple" ; - if (PyFile_Check( py_obj)) return "file" ; if (PyModule_Check( py_obj)) return "module" ; +#if PY_MAJOR_VERSION < 3 + if (PyFile_Check( py_obj)) return "file" ; if (PyInstance_Check(py_obj)) return "instance" ; +#endif return "unknown type"; } @@ -194,7 +196,7 @@ const char* typecode_string(int typecode) { "unsigned short","int","unsigned int","long","unsigned long", "longlong","unsigned longlong", "float","double","long double","complex float","complex double","complex long double", - "object","string","unicode","void","ntypes","notype","char","unkown"}; + "object","string","unicode","void","ntypes","notype","char","unknown"}; return type_names[typecode]; }