[vtk-developers] [vtkusers] More on VTK 5.0.4: hashing vtk class objects broken?
David Gobbi
david.gobbi at gmail.com
Tue Apr 30 17:01:22 EDT 2013
I found a machine that could reproduce the bug. I've submitted a
patch for VTK 6, and I attached a patch for VTK 5.10 to the bug
report.
- David
On Mon, Apr 29, 2013 at 1:30 PM, David Gobbi <david.gobbi at gmail.com> wrote:
> I can't reproduce this on my system. For me, the hash function works
> just fine on VTK classes and instances in VTK 5.10.1.
>
> Can a few other python users try this?
>
> - David
>
>
> On Mon, Apr 29, 2013 at 1:14 PM, E. Tadeu <e.tadeu at gmail.com> wrote:
>> This problem is still happening, I've just tested it with Python 2.7.3 and
>> VTK 5.10.1.
>>
>> I've debugged it inside CPython, and this is what I found:
>>
>> In object.c(1100): calling PyObject_Hash(PyObject *v = vtkObject)
>>
>> PyTypeObject *tp = v->ob_type; // tp is 'vtkclass' from
>> 'vtkCommonPython'
>>
>> It calls, in line 1111: PyType_Ready(tp)
>>
>> (Which seems it should've been called before)
>>
>> In PyType_Ready, typeobject.c(4028), it calls:
>>
>> mro_internal(type)
>>
>> Which fails, because the type does not have the 'mro' attribute.
>>
>>
>> I've created an issue here: http://vtk.org/Bug/view.php?id=14037
>>
>> Thanks!
>>
>>
>>
>> On Wed, May 27, 2009 at 10:56 AM, Berk Geveci <berk.geveci at kitware.com>
>> wrote:
>>>
>>> This is definitely not intentional. Furthermore, I can't reproduce it
>>> on cvs head. Do you know what caused the problem between 5.0.3 and
>>> 5.0.4. Also, can you try 5.4 as I don't think we support 5.0 anymore?
>>>
>>> -berk
>>>
>>> On Wed, May 27, 2009 at 1:19 AM, Carlos Scheidegger
>>> <cscheid at sci.utah.edu> wrote:
>>> > Here's a simpler way to trigger the issue I just mentioned. The core
>>> > problem
>>> > is related to generating a hash from the vtk class object. On VTK 5.0.3
>>> > (and
>>> > Python 2.5.2), I get this:
>>> >
>>> >>>> import vtk
>>> >>>> hash(vtk.vtkObject)
>>> > 140169743808624
>>> >>>> id(vtk.vtkObject)
>>> > 140169743808624
>>> >
>>> > This seems to me the correct behavior. On VTK 5.0.4 (and Python 2.6.2),
>>> > I
>>> > get this:
>>> >
>>> >>>> hash(vtk.vtkObject)
>>> > Traceback (most recent call last):
>>> > File "<stdin>", line 1, in <module>
>>> > AttributeError: mro
>>> >>>> id(vtk.vtkObject)
>>> > 3083232608L
>>> >
>>> > Is this an intended change? It is very convenient to use vtk classes in
>>> > python dictionaries...
>>> >
>>> > Thanks!
>>> > -carlos
More information about the vtk-developers
mailing list