From: <kk...@us...> - 2008-10-17 08:37:05
|
Revision: 1111 http://omc.svn.sourceforge.net/omc/?rev=1111&view=rev Author: kkaempf Date: 2008-10-17 08:36:05 +0000 (Fri, 17 Oct 2008) Log Message: ----------- reduce trace output Modified Paths: -------------- cmpi-bindings/trunk/src/target_python.c Modified: cmpi-bindings/trunk/src/target_python.c =================================================================== --- cmpi-bindings/trunk/src/target_python.c 2008-10-17 08:32:52 UTC (rev 1110) +++ cmpi-bindings/trunk/src/target_python.c 2008-10-17 08:36:05 UTC (rev 1111) @@ -125,11 +125,11 @@ static int PyGlobalInitialize(const CMPIBroker* broker, CMPIStatus* st) { - _SBLIM_TRACE(1,("<%d/0x%x> PyGlobalInitialize() called", getpid(), pthread_self())); +/* _SBLIM_TRACE(1,("<%d/0x%x> PyGlobalInitialize() called", getpid(), pthread_self())); */ if (_TARGET_INIT) { - _SBLIM_TRACE(1,("<%d/0x%x> PyGlobalInitialize() returning: already initialized", getpid(), pthread_self())); +/* _SBLIM_TRACE(1,("<%d/0x%x> PyGlobalInitialize() returning: already initialized", getpid(), pthread_self())); */ return 0; } _TARGET_INIT=1;//true This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2008-11-05 23:31:17
|
Revision: 1148 http://omc.svn.sourceforge.net/omc/?rev=1148&view=rev Author: bartw Date: 2008-11-05 23:31:12 +0000 (Wed, 05 Nov 2008) Log Message: ----------- better handling of cmpi_pywbem_bindings import Modified Paths: -------------- cmpi-bindings/trunk/src/target_python.c Modified: cmpi-bindings/trunk/src/target_python.c =================================================================== --- cmpi-bindings/trunk/src/target_python.c 2008-11-05 19:45:32 UTC (rev 1147) +++ cmpi-bindings/trunk/src/target_python.c 2008-11-05 23:31:12 UTC (rev 1148) @@ -118,7 +118,6 @@ * Global Python initializer * * load the Python interpreter - * import 'cmpi_pywbem_bindings' -> _TARGET_MODULE * init threads */ @@ -143,27 +142,6 @@ cmpiMainPyThreadState = PyGILState_GetThisThreadState(); PyEval_ReleaseThread(cmpiMainPyThreadState); - TARGET_THREAD_BEGIN_BLOCK; - - /* - * import 'cmpi_pywbem_bindings' - */ - - _TARGET_MODULE = PyImport_ImportModule("cmpi_pywbem_bindings"); - if (_TARGET_MODULE == NULL) - { - TARGET_THREAD_END_BLOCK; - _SBLIM_TRACE(1,("<%d/0x%x> Python: import cmpi_pywbem_bindings failed", getpid(), pthread_self())); - CMPIString* trace = get_exc_trace(broker); - _SBLIM_TRACE(1,("<%d/0x%x> %s", getpid(), pthread_self(), - CMGetCharsPtr(trace, NULL))); - _CMPI_SETFAIL(trace); - abort(); - return -1; - } - _SBLIM_TRACE(1,("<%d/0x%x> Python: _TARGET_MODULE at %p", getpid(), pthread_self(), _TARGET_MODULE)); - - TARGET_THREAD_END_BLOCK; _SBLIM_TRACE(1,("<%d/0x%x> PyGlobalInitialize() succeeded", getpid(), pthread_self())); return 0; } @@ -296,6 +274,7 @@ /* + * import 'cmpi_pywbem_bindings' * local (per MI) Python initializer * keeps track of reference count */ @@ -314,9 +293,9 @@ } /* import 'cmpi_pywbem_bindings' */ rc = PyGlobalInitialize(hdl->broker, st); - pthread_mutex_unlock(&_CMPI_INIT_MUTEX); if (rc != 0) { + pthread_mutex_unlock(&_CMPI_INIT_MUTEX); return rc; } @@ -324,6 +303,29 @@ TARGET_THREAD_BEGIN_BLOCK; + /* + * import 'cmpi_pywbem_bindings' + */ + + if (_TARGET_MODULE == NULL) + { + _TARGET_MODULE = PyImport_ImportModule("cmpi_pywbem_bindings"); + if (_TARGET_MODULE == NULL) + { + _SBLIM_TRACE(1,("<%d/0x%x> Python: import cmpi_pywbem_bindings failed", getpid(), pthread_self())); + CMPIString* trace = get_exc_trace(hdl->broker); + PyErr_Clear(); + TARGET_THREAD_END_BLOCK; + _SBLIM_TRACE(1,("<%d/0x%x> %s", getpid(), pthread_self(), + CMGetCharsPtr(trace, NULL))); + _CMPI_SETFAIL(trace); + pthread_mutex_unlock(&_CMPI_INIT_MUTEX); + return -1; + } + } + pthread_mutex_unlock(&_CMPI_INIT_MUTEX); + _SBLIM_TRACE(1,("<%d/0x%x> Python: _TARGET_MODULE at %p", getpid(), pthread_self(), _TARGET_MODULE)); + /* cmpi_pywbem_bindings::get_cmpi_proxy_provider */ PyObject *provclass = PyObject_GetAttrString(_TARGET_MODULE, "get_cmpi_proxy_provider"); @@ -379,10 +381,10 @@ pthread_mutex_unlock(&_CMPI_INIT_MUTEX); return; } - + TARGET_THREAD_BEGIN_BLOCK; - Py_DecRef(_TARGET_MODULE); - TARGET_THREAD_END_BLOCK; + Py_DecRef(_TARGET_MODULE); + TARGET_THREAD_END_BLOCK; PyEval_AcquireLock(); PyThreadState_Swap(cmpiMainPyThreadState); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kk...@us...> - 2008-11-07 11:03:46
|
Revision: 1155 http://omc.svn.sourceforge.net/omc/?rev=1155&view=rev Author: kkaempf Date: 2008-11-07 11:03:43 +0000 (Fri, 07 Nov 2008) Log Message: ----------- don't call Py_DecRef on NULL Modified Paths: -------------- cmpi-bindings/trunk/src/target_python.c Modified: cmpi-bindings/trunk/src/target_python.c =================================================================== --- cmpi-bindings/trunk/src/target_python.c 2008-11-06 16:28:25 UTC (rev 1154) +++ cmpi-bindings/trunk/src/target_python.c 2008-11-07 11:03:43 UTC (rev 1155) @@ -295,9 +295,9 @@ } rc = pi != 0; cleanup: - Py_DecRef(pyargs); - Py_DecRef(pyfunc); - Py_DecRef(prv); + if (pyargs) Py_DecRef(pyargs); + if (pyfunc) Py_DecRef(pyfunc); + if (prv) Py_DecRef(prv); return rc; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |