Additional change to previous commit to avoid memory corruption

This commit is contained in:
vsr 2015-12-01 17:36:05 +03:00
parent 0138a9d57c
commit 6c9327744f

View File

@ -1026,6 +1026,7 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCurveParametric
std::string err_description=""; std::string err_description="";
PyObject* new_stderr = newPyStdOut(err_description); PyObject* new_stderr = newPyStdOut(err_description);
PyObject* old_stderr = PySys_GetObject((char*)"stderr"); PyObject* old_stderr = PySys_GetObject((char*)"stderr");
Py_INCREF(old_stderr);
PySys_SetObject((char*)"stderr", new_stderr); PySys_SetObject((char*)"stderr", new_stderr);
PyErr_Print(); PyErr_Print();
PySys_SetObject((char*)"stderr", old_stderr); PySys_SetObject((char*)"stderr", old_stderr);