[vtkusers] More on VTK 5.0.4: hashing vtk class objects broken?

E. Tadeu e.tadeu at gmail.com
Mon Apr 29 15:14:46 EDT 2013


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
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> > http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130429/4197e26f/attachment.htm>


More information about the vtkusers mailing list