Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
VTK
VTK
Commits
212e9425
Commit
212e9425
authored
Jul 28, 2015
by
David Gobbi
Browse files
Add py3k compatibility macros for type objects.
parent
caa4c93b
Changes
19
Hide whitespace changes
Inline
Side-by-side
Wrapping/PythonCore/CMakeLists.txt
View file @
212e9425
...
...
@@ -16,6 +16,7 @@ set(Module_SRCS
)
set
(
Module_HDRS
vtkPythonCompatibility.h
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
vtk-module
}
Module.h
)
...
...
Wrapping/PythonCore/PyVTKMethodDescriptor.cxx
View file @
212e9425
...
...
@@ -117,7 +117,7 @@ static PyObject *PyVTKMethodDescriptor_Get(
PyExc_TypeError
,
"descriptor '%s' for '%s' objects doesn't apply to '%s' object"
,
PyString_AS_STRING
(
descr
->
d_name
),
descr
->
d_type
->
tp_name
,
obj
->
ob_type
->
tp_name
);
Py_TYPE
(
obj
)
->
tp_name
);
return
NULL
;
}
...
...
@@ -150,8 +150,7 @@ static PyMemberDef PyVTKMethodDescriptor_Members[] = {
//--------------------------------------------------------------------
PyTypeObject
PyVTKMethodDescriptor_Type
=
{
PyObject_HEAD_INIT
(
&
PyType_Type
)
0
,
PyVarObject_HEAD_INIT
(
&
PyType_Type
,
0
)
"vtkCommonCorePython.method_descriptor"
,
// tp_name
sizeof
(
PyMethodDescrObject
),
// tp_basicsize
0
,
// tp_itemsize
...
...
Wrapping/PythonCore/PyVTKMethodDescriptor.h
View file @
212e9425
...
...
@@ -31,7 +31,7 @@
extern
VTKWRAPPINGPYTHONCORE_EXPORT
PyTypeObject
PyVTKMethodDescriptor_Type
;
#define PyVTKMethodDescriptor_Check(obj) \
(
(obj)->ob_type
== &PyVTKMethodDescriptor_Type)
(
Py_TYPE(obj)
== &PyVTKMethodDescriptor_Type)
extern
"C"
{
...
...
Wrapping/PythonCore/PyVTKMutableObject.cxx
View file @
212e9425
...
...
@@ -48,7 +48,7 @@ static const char *PyVTKMutableObject_Doc =
// helper method: make sure than an object is usable
static
PyObject
*
PyVTKMutableObject_CompatibleObject
(
PyObject
*
opn
)
{
PyNumberMethods
*
nb
=
opn
->
ob_type
->
tp_as_number
;
PyNumberMethods
*
nb
=
Py_TYPE
(
opn
)
->
tp_as_number
;
if
(
PyFloat_Check
(
opn
)
||
PyLong_Check
(
opn
)
||
...
...
@@ -382,10 +382,10 @@ static PyObject *PyVTKMutableObject_Hex(PyObject *ob)
#if PY_VERSION_HEX >= 0x02060000
return
PyNumber_ToBase
(
ob
,
16
);
#else
if
(
ob
->
ob_type
->
tp_as_number
&&
ob
->
ob_type
->
tp_as_number
->
nb_hex
)
if
(
Py_TYPE
(
ob
)
->
tp_as_number
&&
Py_TYPE
(
ob
)
->
tp_as_number
->
nb_hex
)
{
return
ob
->
ob_type
->
tp_as_number
->
nb_hex
(
ob
);
return
Py_TYPE
(
ob
)
->
tp_as_number
->
nb_hex
(
ob
);
}
PyErr_SetString
(
PyExc_TypeError
,
...
...
@@ -400,10 +400,10 @@ static PyObject *PyVTKMutableObject_Oct(PyObject *ob)
#if PY_VERSION_HEX >= 0x02060000
return
PyNumber_ToBase
(
ob
,
8
);
#else
if
(
ob
->
ob_type
->
tp_as_number
&&
ob
->
ob_type
->
tp_as_number
->
nb_oct
)
if
(
Py_TYPE
(
ob
)
->
tp_as_number
&&
Py_TYPE
(
ob
)
->
tp_as_number
->
nb_oct
)
{
return
ob
->
ob_type
->
tp_as_number
->
nb_oct
(
ob
);
return
Py_TYPE
(
ob
)
->
tp_as_number
->
nb_oct
(
ob
);
}
PyErr_SetString
(
PyExc_TypeError
,
...
...
@@ -564,16 +564,16 @@ static Py_ssize_t PyVTKMutableObject_GetReadBuf(
char
text
[
80
];
PyBufferProcs
*
pb
;
op
=
((
PyVTKMutableObject
*
)
op
)
->
value
;
pb
=
op
->
ob_type
->
tp_as_buffer
;
pb
=
Py_TYPE
(
op
)
->
tp_as_buffer
;
if
(
pb
&&
pb
->
bf_getreadbuffer
)
{
return
op
->
ob_type
->
tp_as_buffer
->
bf_getreadbuffer
(
return
Py_TYPE
(
op
)
->
tp_as_buffer
->
bf_getreadbuffer
(
op
,
segment
,
ptrptr
);
}
sprintf
(
text
,
"type
\'
%.20s
\'
does not support readable buffer access"
,
op
->
ob_type
->
tp_name
);
Py_TYPE
(
op
)
->
tp_name
);
PyErr_SetString
(
PyExc_TypeError
,
text
);
return
-
1
;
...
...
@@ -585,16 +585,16 @@ static Py_ssize_t PyVTKMutableObject_GetWriteBuf(
char
text
[
80
];
PyBufferProcs
*
pb
;
op
=
((
PyVTKMutableObject
*
)
op
)
->
value
;
pb
=
op
->
ob_type
->
tp_as_buffer
;
pb
=
Py_TYPE
(
op
)
->
tp_as_buffer
;
if
(
pb
&&
pb
->
bf_getwritebuffer
)
{
return
op
->
ob_type
->
tp_as_buffer
->
bf_getwritebuffer
(
return
Py_TYPE
(
op
)
->
tp_as_buffer
->
bf_getwritebuffer
(
op
,
segment
,
ptrptr
);
}
sprintf
(
text
,
"type
\'
%.20s
\'
does not support writeable buffer access"
,
op
->
ob_type
->
tp_name
);
Py_TYPE
(
op
)
->
tp_name
);
PyErr_SetString
(
PyExc_TypeError
,
text
);
return
-
1
;
...
...
@@ -606,15 +606,15 @@ PyVTKMutableObject_GetSegCount(PyObject *op, Py_ssize_t *lenp)
char
text
[
80
];
PyBufferProcs
*
pb
;
op
=
((
PyVTKMutableObject
*
)
op
)
->
value
;
pb
=
op
->
ob_type
->
tp_as_buffer
;
pb
=
Py_TYPE
(
op
)
->
tp_as_buffer
;
if
(
pb
&&
pb
->
bf_getsegcount
)
{
return
op
->
ob_type
->
tp_as_buffer
->
bf_getsegcount
(
op
,
lenp
);
return
Py_TYPE
(
op
)
->
tp_as_buffer
->
bf_getsegcount
(
op
,
lenp
);
}
sprintf
(
text
,
"type
\'
%.20s
\'
does not support buffer access"
,
op
->
ob_type
->
tp_name
);
Py_TYPE
(
op
)
->
tp_name
);
PyErr_SetString
(
PyExc_TypeError
,
text
);
return
-
1
;
...
...
@@ -626,16 +626,16 @@ static Py_ssize_t PyVTKMutableObject_GetCharBuf(
char
text
[
80
];
PyBufferProcs
*
pb
;
op
=
((
PyVTKMutableObject
*
)
op
)
->
value
;
pb
=
op
->
ob_type
->
tp_as_buffer
;
pb
=
Py_TYPE
(
op
)
->
tp_as_buffer
;
if
(
pb
&&
pb
->
bf_getcharbuffer
)
{
return
op
->
ob_type
->
tp_as_buffer
->
bf_getcharbuffer
(
return
Py_TYPE
(
op
)
->
tp_as_buffer
->
bf_getcharbuffer
(
op
,
segment
,
ptrptr
);
}
sprintf
(
text
,
"type
\'
%.20s
\'
does not support character buffer access"
,
op
->
ob_type
->
tp_name
);
Py_TYPE
(
op
)
->
tp_name
);
PyErr_SetString
(
PyExc_TypeError
,
text
);
return
-
1
;
...
...
@@ -665,7 +665,7 @@ static PyObject *PyVTKMutableObject_Repr(PyObject *ob)
{
char
textspace
[
128
];
PyObject
*
r
=
0
;
const
char
*
name
=
ob
->
ob_type
->
tp_name
;
const
char
*
name
=
Py_TYPE
(
ob
)
->
tp_name
;
PyObject
*
s
=
PyObject_Repr
(((
PyVTKMutableObject
*
)
ob
)
->
value
);
if
(
s
)
{
...
...
@@ -724,7 +724,7 @@ static PyObject *PyVTKMutableObject_GetAttr(PyObject *self, PyObject *attr)
}
sprintf
(
text
,
"'%.20s' object has no attribute '%.80s'"
,
self
->
ob_type
->
tp_name
,
name
);
Py_TYPE
(
self
)
->
tp_name
,
name
);
PyErr_SetString
(
PyExc_AttributeError
,
text
);
return
NULL
;
}
...
...
@@ -758,8 +758,7 @@ static PyObject *PyVTKMutableObject_New(
//--------------------------------------------------------------------
PyTypeObject
PyVTKMutableObject_Type
=
{
PyObject_HEAD_INIT
(
&
PyType_Type
)
0
,
PyVarObject_HEAD_INIT
(
&
PyType_Type
,
0
)
"vtkCommonCorePython.mutable"
,
// tp_name
sizeof
(
PyVTKMutableObject
),
// tp_basicsize
0
,
// tp_itemsize
...
...
Wrapping/PythonCore/PyVTKMutableObject.h
View file @
212e9425
...
...
@@ -35,7 +35,8 @@ struct PyVTKMutableObject {
extern
VTKWRAPPINGPYTHONCORE_EXPORT
PyTypeObject
PyVTKMutableObject_Type
;
#define PyVTKMutableObject_Check(obj) ((obj)->ob_type == &PyVTKMutableObject_Type)
#define PyVTKMutableObject_Check(obj) \
(Py_TYPE(obj) == &PyVTKMutableObject_Type)
extern
"C"
{
...
...
Wrapping/PythonCore/PyVTKNamespace.cxx
View file @
212e9425
...
...
@@ -45,8 +45,7 @@ static void PyVTKNamespace_Delete(PyObject *op)
//--------------------------------------------------------------------
PyTypeObject
PyVTKNamespace_Type
=
{
PyObject_HEAD_INIT
(
&
PyType_Type
)
0
,
PyVarObject_HEAD_INIT
(
&
PyType_Type
,
0
)
"vtkCommonCorePython.namespace"
,
// tp_name
0
,
// tp_basicsize
0
,
// tp_itemsize
...
...
Wrapping/PythonCore/PyVTKNamespace.h
View file @
212e9425
...
...
@@ -27,7 +27,8 @@
extern
VTKWRAPPINGPYTHONCORE_EXPORT
PyTypeObject
PyVTKNamespace_Type
;
#define PyVTKNamespace_Check(obj) ((obj)->ob_type == &PyVTKNamespace_Type)
#define PyVTKNamespace_Check(obj) \
(Py_TYPE(obj) == &PyVTKNamespace_Type)
extern
"C"
{
...
...
Wrapping/PythonCore/PyVTKObject.cxx
View file @
212e9425
...
...
@@ -131,7 +131,7 @@ PyObject *PyVTKObject_String(PyObject *op)
PyObject
*
PyVTKObject_Repr
(
PyObject
*
op
)
{
char
buf
[
255
];
sprintf
(
buf
,
"(%.200s)%p"
,
op
->
ob_type
->
tp_name
,
static_cast
<
void
*>
(
op
));
sprintf
(
buf
,
"(%.200s)%p"
,
Py_TYPE
(
op
)
->
tp_name
,
static_cast
<
void
*>
(
op
));
return
PyString_FromString
(
buf
);
}
...
...
@@ -243,7 +243,7 @@ static PyObject *PyVTKObject_GetThis(PyObject *op, void *)
// otherwise, use the pythonic form of the class name
if
(
*
cp
!=
'\0'
)
{
classname
=
vtkPythonUtil
::
StripModule
(
op
->
ob_type
->
tp_name
);
classname
=
vtkPythonUtil
::
StripModule
(
Py_TYPE
(
op
)
->
tp_name
);
}
sprintf
(
buf
,
"p_%.500s"
,
classname
);
return
PyString_FromString
(
...
...
Wrapping/PythonCore/PyVTKSpecialObject.cxx
View file @
212e9425
...
...
@@ -61,8 +61,8 @@ PyVTKSpecialType::PyVTKSpecialType(
PyObject
*
PyVTKSpecialObject_Repr
(
PyObject
*
self
)
{
PyVTKSpecialObject
*
obj
=
(
PyVTKSpecialObject
*
)
self
;
PyTypeObject
*
type
=
self
->
ob_type
;
const
char
*
name
=
self
->
ob_type
->
tp_name
;
PyTypeObject
*
type
=
Py_TYPE
(
self
)
;
const
char
*
name
=
Py_TYPE
(
self
)
->
tp_name
;
PyObject
*
s
=
PyString_FromString
(
"("
);
PyString_ConcatAndDel
(
&
s
,
PyString_FromString
(
name
));
...
...
@@ -106,9 +106,9 @@ PyObject *PyVTKSpecialObject_SequenceString(PyObject *self)
PyObject
*
t
,
*
o
,
*
comma
;
const
char
*
bracket
=
"[...]"
;
if
(
self
->
ob_type
->
tp_as_sequence
&&
self
->
ob_type
->
tp_as_sequence
->
sq_item
!=
NULL
&&
self
->
ob_type
->
tp_as_sequence
->
sq_ass_item
==
NULL
)
if
(
Py_TYPE
(
self
)
->
tp_as_sequence
&&
Py_TYPE
(
self
)
->
tp_as_sequence
->
sq_item
!=
NULL
&&
Py_TYPE
(
self
)
->
tp_as_sequence
->
sq_ass_item
==
NULL
)
{
bracket
=
"(...)"
;
}
...
...
Wrapping/PythonCore/PyVTKTemplate.cxx
View file @
212e9425
...
...
@@ -280,7 +280,7 @@ static PyObject *PyVTKTemplate_Repr(PyObject *op)
PyVTKTemplate
*
self
=
(
PyVTKTemplate
*
)
op
;
return
PyString_FromFormat
(
"<%s %s.%s>"
,
op
->
ob_type
->
tp_name
,
Py_TYPE
(
op
)
->
tp_name
,
PyString_AS_STRING
(
self
->
module
),
PyString_AS_STRING
(
self
->
name
));
}
...
...
@@ -297,8 +297,7 @@ static PyObject *PyVTKTemplate_Call(PyObject *, PyObject *, PyObject *)
//--------------------------------------------------------------------
PyTypeObject
PyVTKTemplate_Type
=
{
PyObject_HEAD_INIT
(
&
PyType_Type
)
0
,
PyVarObject_HEAD_INIT
(
&
PyType_Type
,
0
)
"vtkCommonCorePython.template"
,
// tp_name
sizeof
(
PyVTKTemplate
),
// tp_basicsize
0
,
// tp_itemsize
...
...
Wrapping/PythonCore/PyVTKTemplate.h
View file @
212e9425
...
...
@@ -39,7 +39,8 @@ struct PyVTKTemplate {
extern
VTKWRAPPINGPYTHONCORE_EXPORT
PyTypeObject
PyVTKTemplate_Type
;
#define PyVTKTemplate_Check(obj) ((obj)->ob_type == &PyVTKTemplate_Type)
#define PyVTKTemplate_Check(obj) \
(Py_TYPE(obj) == &PyVTKTemplate_Type)
extern
"C"
{
...
...
Wrapping/PythonCore/vtkPythonArgs.cxx
View file @
212e9425
...
...
@@ -163,7 +163,7 @@ inline bool vtkPythonGetStdStringValue(PyObject *o, std::string &a, const char *
static
bool
vtkPythonGetValue
(
PyObject
*
o
,
const
void
*&
a
)
{
PyBufferProcs
*
b
=
o
->
ob_type
->
tp_as_buffer
;
PyBufferProcs
*
b
=
Py_TYPE
(
o
)
->
tp_as_buffer
;
if
(
b
&&
b
->
bf_getreadbuffer
&&
b
->
bf_getsegcount
)
{
if
(
b
->
bf_getsegcount
(
o
,
NULL
)
==
1
)
...
...
@@ -902,7 +902,7 @@ int vtkPythonArgs::GetArgAsEnum(
std
::
string
errstring
=
"expected enum "
;
errstring
+=
enumname
;
errstring
+=
", got "
;
errstring
+=
o
->
ob_type
->
tp_name
;
errstring
+=
Py_TYPE
(
o
)
->
tp_name
;
PyErr_SetString
(
PyExc_TypeError
,
errstring
.
c_str
());
valid
=
false
;
}
...
...
@@ -1299,7 +1299,7 @@ bool vtkPythonSequenceError(PyObject *o, Py_ssize_t n, Py_ssize_t m)
if
(
m
==
n
)
{
sprintf
(
text
,
"expected a sequence of %ld value%s, got %s"
,
(
long
)
n
,
((
n
==
1
)
?
""
:
"s"
),
o
->
ob_type
->
tp_name
);
(
long
)
n
,
((
n
==
1
)
?
""
:
"s"
),
Py_TYPE
(
o
)
->
tp_name
);
}
else
{
...
...
Wrapping/PythonCore/vtkPythonCompatibility.h
0 → 100644
View file @
212e9425
/*=========================================================================
Program: Visualization Toolkit
Module: vtkPythonCompatibility.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*-----------------------------------------------------------------------
This header contains macros to make Python 2 and Python 3 play nice.
It must be included after vtkPython.h.
-----------------------------------------------------------------------*/
// define our main check macro VTK_PY3K
#if PY_MAJOR_VERSION >= 3
#define VTK_PY3K
#endif
// ===== Macros needed for Python 3 ====
#ifdef VTK_PY3K
#endif
// ===== Macros needed for Python 2 ====
#ifndef VTK_PY3K
// Required for Python 2.5 compatibility
#ifndef PyVarObject_HEAD_INIT
#define PyVarObject_HEAD_INIT(type, size) \
PyObject_HEAD_INIT(type) size,
#endif
// Required for Python 2.5 compatibility
#ifndef Py_TYPE
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#endif
#endif
Wrapping/PythonCore/vtkPythonOverload.cxx
View file @
212e9425
...
...
@@ -414,7 +414,7 @@ int vtkPythonOverload::CheckArg(
penalty
=
VTK_PYTHON_NEEDS_CONVERSION
;
}
// make sure that arg can act as a buffer
else
if
(
arg
->
ob_type
->
tp_as_buffer
==
0
)
else
if
(
Py_TYPE
(
arg
)
->
tp_as_buffer
==
0
)
{
penalty
=
VTK_PYTHON_INCOMPATIBLE
;
}
...
...
@@ -446,10 +446,10 @@ int vtkPythonOverload::CheckArg(
{
PyVTKClass
*
info
=
vtkPythonUtil
::
FindClass
(
classname
);
PyTypeObject
*
pytype
=
(
info
?
info
->
py_type
:
NULL
);
if
(
arg
->
ob_type
!=
pytype
)
if
(
Py_TYPE
(
arg
)
!=
pytype
)
{
// Check superclasses
PyTypeObject
*
basetype
=
arg
->
ob_type
->
tp_base
;
PyTypeObject
*
basetype
=
Py_TYPE
(
arg
)
->
tp_base
;
penalty
=
VTK_PYTHON_GOOD_MATCH
;
while
(
basetype
&&
basetype
!=
pytype
)
{
...
...
@@ -482,10 +482,10 @@ int vtkPythonOverload::CheckArg(
PyTypeObject
*
pytype
=
(
info
?
info
->
py_type
:
NULL
);
// Check for an exact match
if
(
arg
->
ob_type
!=
pytype
)
if
(
Py_TYPE
(
arg
)
!=
pytype
)
{
// Check superclasses
PyTypeObject
*
basetype
=
arg
->
ob_type
->
tp_base
;
PyTypeObject
*
basetype
=
Py_TYPE
(
arg
)
->
tp_base
;
penalty
=
VTK_PYTHON_GOOD_MATCH
;
while
(
basetype
&&
basetype
!=
pytype
)
{
...
...
@@ -524,10 +524,10 @@ int vtkPythonOverload::CheckArg(
PyTypeObject
*
pytype
=
(
info
?
info
->
py_type
:
NULL
);
// Check for an exact match
if
(
arg
->
ob_type
!=
pytype
)
if
(
Py_TYPE
(
arg
)
!=
pytype
)
{
// Check superclasses
PyTypeObject
*
basetype
=
arg
->
ob_type
->
tp_base
;
PyTypeObject
*
basetype
=
Py_TYPE
(
arg
)
->
tp_base
;
penalty
=
VTK_PYTHON_GOOD_MATCH
;
while
(
basetype
&&
basetype
!=
pytype
)
{
...
...
Wrapping/PythonCore/vtkPythonUtil.cxx
View file @
212e9425
...
...
@@ -382,7 +382,7 @@ void vtkPythonUtil::RemoveObjectFromMap(PyObject *obj)
vtkWeakPointerBase
wptr
;
// check for customized class or dict
if
(
pobj
->
vtk_class
->
py_type
!=
pobj
->
ob_type
||
if
(
pobj
->
vtk_class
->
py_type
!=
Py_TYPE
(
pobj
)
||
PyDict_Size
(
pobj
->
vtk_dict
))
{
wptr
=
pobj
->
vtk_ptr
;
...
...
@@ -416,7 +416,7 @@ void vtkPythonUtil::RemoveObjectFromMap(PyObject *obj)
// Add this new ghost to the map
PyVTKObjectGhost
&
g
=
(
*
vtkPythonMap
->
GhostMap
)[
pobj
->
vtk_ptr
];
g
.
vtk_ptr
=
wptr
;
g
.
vtk_class
=
pobj
->
ob_type
;
g
.
vtk_class
=
Py_TYPE
(
pobj
)
;
g
.
vtk_dict
=
pobj
->
vtk_dict
;
Py_INCREF
(
g
.
vtk_class
);
Py_INCREF
(
g
.
vtk_dict
);
...
...
@@ -777,7 +777,7 @@ void *vtkPythonUtil::GetPointerFromSpecialObject(
PyObject
*
obj
,
const
char
*
result_type
,
PyObject
**
newobj
)
{
const
char
*
object_type
=
vtkPythonUtil
::
StripModule
(
obj
->
ob_type
->
tp_name
);
vtkPythonUtil
::
StripModule
(
Py_TYPE
(
obj
)
->
tp_name
);
// do a lookup on the desired type
vtkPythonSpecialTypeMap
::
iterator
it
=
...
...
Wrapping/PythonCore/vtkPythonUtil.h
View file @
212e9425
...
...
@@ -19,6 +19,7 @@
#define vtkPythonUtil_h
#include
"vtkPython.h"
#include
"vtkPythonCompatibility.h"
#include
"PyVTKMutableObject.h"
#include
"PyVTKNamespace.h"
#include
"PyVTKObject.h"
...
...
Wrapping/Tools/vtkWrapPythonClass.c
View file @
212e9425
...
...
@@ -445,8 +445,7 @@ void vtkWrapPython_GenerateObjectType(
/* Generate the TypeObject */
fprintf
(
fp
,
"static PyTypeObject Py%s_Type = {
\n
"
" PyObject_HEAD_INIT(&PyType_Type)
\n
"
" 0,
\n
"
" PyVarObject_HEAD_INIT(&PyType_Type, 0)
\n
"
"
\"
%sPython.%s
\"
, // tp_name
\n
"
" sizeof(PyVTKObject), // tp_basicsize
\n
"
" 0, // tp_itemsize
\n
"
...
...
Wrapping/Tools/vtkWrapPythonEnum.c
View file @
212e9425
...
...
@@ -139,8 +139,7 @@ void vtkWrapPython_GenerateEnumType(
/* generate the TypeObject */
fprintf
(
fp
,
"static PyTypeObject Py%s_Type = {
\n
"
" PyObject_HEAD_INIT(&PyType_Type)
\n
"
" 0,
\n
"
" PyVarObject_HEAD_INIT(&PyType_Type, 0)
\n
"
"
\"
%sPython.%s
\"
, // tp_name
\n
"
" sizeof(PyIntObject), // tp_basicsize
\n
"
" 0, // tp_itemsize
\n
"
...
...
Wrapping/Tools/vtkWrapPythonType.c
View file @
212e9425
...
...
@@ -549,7 +549,7 @@ static void vtkWrapPython_HashProtocol(
" return PyObject_HashNotImplemented(self);
\n
"
"#else
\n
"
" char text[256];
\n
"
" sprintf(text,
\"
unhashable type:
\'
%%s
\'\"
,
self->ob_type
->tp_name);
\n
"
" sprintf(text,
\"
unhashable type:
\'
%%s
\'\"
,
Py_TYPE(self)
->tp_name);
\n
"
" PyErr_SetString(PyExc_TypeError, text);
\n
"
" return -1;
\n
"
"#endif
\n
"
...
...
@@ -661,8 +661,7 @@ void vtkWrapPython_GenerateSpecialType(
/* Generate the TypeObject */
fprintf
(
fp
,
"static PyTypeObject Py%s_Type = {
\n
"
" PyObject_HEAD_INIT(&PyType_Type)
\n
"
" 0,
\n
"
" PyVarObject_HEAD_INIT(&PyType_Type, 0)
\n
"
"
\"
%sPython.%s
\"
, // tp_name
\n
"
" sizeof(PyVTKSpecialObject), // tp_basicsize
\n
"
" 0, // tp_itemsize
\n
"
...
...
@@ -772,7 +771,7 @@ void vtkWrapPython_GenerateSpecialType(
fprintf
(
fp
,
"static int Py%s_CheckExact(PyObject *ob)
\n
"
"{
\n
"
" return (
ob->ob_type
== &Py%s_Type);
\n
"
" return (
Py_TYPE(ob)
== &Py%s_Type);
\n
"
"}
\n\n
"
,
classname
,
classname
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment