Fix various issues:

+ fix dangling pointers when fetching Python error text
+ initialize members in overloaded constructors of Exception class
+ implement assignment operator in sub-class
+ move to PyCXX API to simplify handling with reference counting and reading values from the dict
This commit is contained in:
wmayer
2017-05-15 18:49:09 +02:00
parent 38e313f0e0
commit 1d8206acbf
5 changed files with 65 additions and 58 deletions

View File

@@ -23,6 +23,7 @@
#include "PreCompiled.h"
#include "ExceptionFactory.h"
#include <CXX/Objects.hxx>
using namespace Base;
@@ -46,12 +47,9 @@ void ExceptionFactory::raiseException (PyObject * pydict) const
{
std::string classname;
PyObject *pystring;
pystring = PyDict_GetItemString(pydict,"sclassname");
if(pystring!=NULL) {
classname = std::string(PyString_AsString(pystring));
Py::Dict edict(pydict);
if (edict.hasKey("sclassname")) {
classname = static_cast<std::string>(Py::String(edict.getItem("sclassname")));
std::map<const std::string, AbstractProducer*>::const_iterator pProd;