SF bug #978308, Spurious errors taking bool of dead pro

Need to return -1 on error.

Needs backport.
This commit is contained in:
Neal Norwitz 2004-07-08 01:22:31 +00:00
parent bd7f76dd04
commit bdcb9410c2
2 changed files with 2 additions and 1 deletions

View file

@ -504,7 +504,7 @@ proxy_nonzero(PyWeakReference *proxy)
{
PyObject *o = PyWeakref_GET_OBJECT(proxy);
if (!proxy_checkref(proxy))
return 1;
return -1;
if (o->ob_type->tp_as_number &&
o->ob_type->tp_as_number->nb_nonzero)
return (*o->ob_type->tp_as_number->nb_nonzero)(o);