Commit 7e31cd5f authored by David Gobbi's avatar David Gobbi
Browse files

ENH: Allow help() to work on VTK classes with Python 2.7.

In Python 2.7, the inspect.isclass() method became more restrictive,
and the python documentation system stopped recognizing VTK classes
as true Python classes, since VTK classes still use a mechanism from
the days of Python 1.5.  This patch makes PyVTKClass into a subclass
of PyClass, and now the inspect module recognizes VTK classes as true
Python classes.

Change-Id: I83fa6b5adb7fdef53036069a83a2dae64dffd4ae
parent 4b59e498
......@@ -405,7 +405,7 @@ PyTypeObject PyVTKClass_Type = {
0, // tp_setattro
0, // tp_as_buffer
#if PY_VERSION_HEX >= 0x02020000
Py_TPFLAGS_HAVE_GC, // tp_flags
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, // tp_flags
#else
0, // tp_flags
#endif
......@@ -418,7 +418,29 @@ PyTypeObject PyVTKClass_Type = {
#else
0, 0, 0, 0, // reserved
#endif
VTK_PYTHON_UTIL_SUPRESS_UNINITIALIZED
#if PY_VERSION_HEX >= 0x02020000
0, // tp_iter
0, // tp_iternext
0, // tp_methods
0, // tp_members
0, // tp_getset
&PyClass_Type, // tp_base
0, // tp_dict
0, // tp_descr_get
0, // tp_descr_set
0, // tp_dictoffset
0, // tp_init
0, // tp_alloc
0, // tp_new
0, // tp_free
0, // tp_is_gc
0, // tp_bases
0, // tp_mro
0, // tp_cache
0, // tp_subclasses
0, // tp_weaklist
#endif
VTK_WRAP_PYTHON_SUPRESS_UNINITIALIZED
};
PyObject *PyVTKClass_GetDict(PyObject *obj)
......
......@@ -398,7 +398,7 @@ PyTypeObject PyVTKObject_Type = {
PyVTKObject_SetAttr, // tp_setattro
&PyVTKObject_AsBuffer, // tp_as_buffer
#if PY_VERSION_HEX >= 0x02020000
Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_WEAKREFS, // tp_flags
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, // tp_flags
#elif PY_VERSION_HEX >= 0x02010000
Py_TPFLAGS_HAVE_WEAKREFS, // tp_flags
#else
......@@ -417,7 +417,29 @@ PyTypeObject PyVTKObject_Type = {
#else
0, 0, 0, 0, // reserved
#endif
VTK_PYTHON_UTIL_SUPRESS_UNINITIALIZED
#if PY_VERSION_HEX >= 0x02020000
0, // tp_iter
0, // tp_iternext
0, // tp_methods
0, // tp_members
0, // tp_getset
0, // tp_base
0, // tp_dict
0, // tp_descr_get
0, // tp_descr_set
0, // tp_dictoffset
0, // tp_init
0, // tp_alloc
0, // tp_new
0, // tp_free
0, // tp_is_gc
0, // tp_bases
0, // tp_mro
0, // tp_cache
0, // tp_subclasses
0, // tp_weaklist
#endif
VTK_WRAP_PYTHON_SUPRESS_UNINITIALIZED
};
PyObject *PyVTKObject_New(
......
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