Hi Martin,

On Tue, Aug 08, 2006 at 11:14:56PM +0200, "Martin v. L?wis" wrote:
> -               h = PyInt_AsLong(res);
> +               if (PyLong_Check(res))
> +                       h = res->ob_type->tp_hash(res);

This bug will keep showing up forever :-)  It's unsafe against a user
subclassing 'long' and overriding __hash__ of that subclass to return
the object itself -- it would cause an infinite C recursion.

Instead, we need either a new API like PyLong_Hash(), or call
'PyLong_Type.tp_hash(res)'.

Same in the other change.


A bientot,

Armin
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to