Salome HOME
projects
/
modules
/
shaper.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Issue #328: bug with hanging of the app on absent file sourcing fixed
[modules/shaper.git]
/
src
/
Config
/
Config_ModuleReader.cpp
diff --git
a/src/Config/Config_ModuleReader.cpp
b/src/Config/Config_ModuleReader.cpp
index d0da80ba0a8f0914a27ea7baa8706096f209f066..526b9965f51aebc1b97b482991fa5d2a1fa2da66 100644
(file)
--- a/
src/Config/Config_ModuleReader.cpp
+++ b/
src/Config/Config_ModuleReader.cpp
@@
-173,18
+173,21
@@
void Config_ModuleReader::loadScript(const std::string theFileName)
{
/* aquire python thread */
PyGILState_STATE gstate = PyGILState_Ensure();
{
/* aquire python thread */
PyGILState_STATE gstate = PyGILState_Ensure();
- PyObject* module = PyImport_ImportModule(theFileName.c_str());
+ PyObject* module = PyImport_ImportModule(theFileName.c_str());
if (!module) {
std::string anErrorMsg = "An error occured while importing " + theFileName;
//Get detailed error message:
if (PyErr_Occurred()) {
if (!module) {
std::string anErrorMsg = "An error occured while importing " + theFileName;
//Get detailed error message:
if (PyErr_Occurred()) {
- PyObject *ptype, *pvalue, *ptraceback;
+ PyObject *p
str, *p
type, *pvalue, *ptraceback;
PyErr_Fetch(&ptype, &pvalue, &ptraceback);
PyErr_Fetch(&ptype, &pvalue, &ptraceback);
- std::string aPyError = std::string(PyString_AsString(pvalue));
+ PyErr_NormalizeException(&ptype, &pvalue, &ptraceback);
+ pstr = PyObject_Str(pvalue);
+ std::string aPyError = std::string(PyString_AsString(pstr));
if (!aPyError.empty()) {
anErrorMsg += ":\n" + aPyError;
}
if (!aPyError.empty()) {
anErrorMsg += ":\n" + aPyError;
}
+ Py_XDECREF(pstr);
Py_XDECREF(ptype);
Py_XDECREF(pvalue);
Py_XDECREF(ptraceback);
Py_XDECREF(ptype);
Py_XDECREF(pvalue);
Py_XDECREF(ptraceback);