Commit 6479d891 authored by David Gobbi's avatar David Gobbi
Browse files

BUG: Fix infinite loop when printing object from python.

The python str and repr methods could recursively reference each
other if special-wrapped types did not define a str method, which
occurred when the C++ header didn't define operator<< for streaming.

Change-Id: I29ba591ac933a37401674ad40d94d60e88d06a70
parent d984529e
......@@ -70,10 +70,9 @@ PyObject *PyVTKSpecialObject_Repr(PyObject *self)
type = type->tp_base;
// use str() if available
if (type->tp_str)
if (type->tp_str && type->tp_str != (&PyBaseObject_Type)->tp_str)
PyObject *t = type->tp_str(self);
if (t == NULL)
......@@ -87,7 +86,9 @@ PyObject *PyVTKSpecialObject_Repr(PyObject *self)
// otherwise just print address of object
else if (obj->vtk_ptr)
if (obj->vtk_ptr)
char buf[256];
sprintf(buf, "%p", obj->vtk_ptr);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment