[PySide] Bug with new hash table feature

John Ehresman jpe at wingware.com
Wed May 30 21:35:08 CEST 2012


On 5/30/12 3:19 PM, Nathan Smith wrote:
> There had better never be an address at -1 or the hash function won't
> work right.  The Python documentation
> (http://docs.python.org/c-api/typeobj.html#PyTypeObject.tp_hash) says
> that hash should only return -1 if there was an exception set.  If it's
> possible to have an address -1, then we need a different hash function
> than just returning address.

I'd simply return -2 if the value is -1 just to be on the safe side.

> Can we use the address of the Shiboken object as the hash value?  That
> remains valid so long as there are references to the object, even after
> the object itself has been deleted in C++ land.

This works if there can only be one wrapper at a time for a given 
QObject.  I don't know if this is the case.

John



More information about the PySide mailing list