Skip to content
Snippets Groups Projects
Commit 1a04e8a1 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

Merge remote-tracking branch 'gl/dgobbi/python-py3k' into release-6.3

* gl/dgobbi/python-py3k:
  Fixing bug from 5b6e9c49 with test inversion
  PyVTKObject: add .c_str()
  PyVTKObject: shorten the lifetime of the `s` object
  PyVTKObject: own the classname memory
parents cfde98ae 4421cbad
No related merge requests found
......@@ -487,14 +487,14 @@ PyObject *PyVTKObject_FromPointer(
{
// This will be set if we create a new C++ object
bool created = false;
const char *classname = vtkPythonUtil::StripModule(pytype->tp_name);
std::string classname = vtkPythonUtil::StripModule(pytype->tp_name);
PyVTKClass *cls = 0;
if (ptr)
{
// If constructing from an existing C++ object, use its actual class
classname = ptr->GetClassName();
cls = vtkPythonUtil::FindClass(classname);
cls = vtkPythonUtil::FindClass(classname.c_str());
}
if (cls == 0)
......@@ -511,23 +511,23 @@ PyObject *PyVTKObject_FromPointer(
s = tmp;
}
#endif
classname = PyBytes_AsString(s);
if (classname == 0)
const char *vtkname_classname = PyBytes_AsString(s);
if (vtkname_classname == 0)
{
Py_DECREF(s);
return NULL;
}
classname = vtkname_classname;
Py_DECREF(s);
}
cls = vtkPythonUtil::FindClass(classname);
cls = vtkPythonUtil::FindClass(classname.c_str());
if (cls == 0)
{
PyErr_Format(PyExc_ValueError,
"internal error, unknown VTK class %.200s",
classname);
Py_XDECREF(s);
classname.c_str());
return NULL;
}
Py_XDECREF(s);
}
if (!ptr)
......@@ -550,7 +550,7 @@ PyObject *PyVTKObject_FromPointer(
// Check the type of the newly-created object
const char *newclassname = ptr->GetClassName();
if (strcmp(newclassname, classname) != 0)
if (std::string(newclassname) != classname)
{
PyVTKClass *newclass = vtkPythonUtil::FindClass(newclassname);
if (newclass)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment