From 9689060a4d0b66d5e3cd164a1bb023c79d02810d Mon Sep 17 00:00:00 2001 From: Gilles DAVID Date: Thu, 30 Mar 2017 15:43:50 +0200 Subject: [PATCH] [PY3] New Python C module initialisation --- src/SALOME_PY/SalomePy.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/SALOME_PY/SalomePy.cxx b/src/SALOME_PY/SalomePy.cxx index cc5dc8697..ed7ce5028 100755 --- a/src/SALOME_PY/SalomePy.cxx +++ b/src/SALOME_PY/SalomePy.cxx @@ -91,10 +91,10 @@ { \ PyObject *w; \ int rc; \ - if ( ( w = PyInt_FromLong( i ) ) == NULL ) return; \ + if ( ( w = PyLong_FromLong( i ) ) == NULL ) return NULL; \ rc = PyDict_SetItemString( aModuleDict, #i, w ); \ Py_DECREF( w ); \ - if ( rc < 0 ) return; \ + if ( rc < 0 ) return NULL; \ } //! View operation type @@ -538,19 +538,19 @@ static struct PyModuleDef moduledef = { \brief Python module initialization. \internal */ -extern "C" SALOMEPY_EXPORT void initlibSalomePy() +extern "C" SALOMEPY_EXPORT PyMODINIT_FUNC PyInit_libSalomePy(void) { // init module PyObject *aModule = PyModule_Create(&moduledef); if( PyErr_Occurred() ) { PyErr_Print(); - return; + return NULL; } // get module's dictionary PyObject *aModuleDict = PyModule_GetDict( aModule ); if ( aModuleDict == NULL ) - return; + return NULL; // export View type enumeration PUBLISH_ENUM( ViewFront ); @@ -559,4 +559,6 @@ extern "C" SALOMEPY_EXPORT void initlibSalomePy() PUBLISH_ENUM( ViewBottom ); PUBLISH_ENUM( ViewRight ); PUBLISH_ENUM( ViewLeft ); + + return aModule; } -- 2.39.2