mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
SF bug #1770766: weakref proxy has incorrect __nonzero__ behavior.
This commit is contained in:
parent
ca5d8fea3d
commit
e6c470f255
2 changed files with 7 additions and 5 deletions
|
@ -505,11 +505,7 @@ proxy_nonzero(PyWeakReference *proxy)
|
|||
PyObject *o = PyWeakref_GET_OBJECT(proxy);
|
||||
if (!proxy_checkref(proxy))
|
||||
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);
|
||||
else
|
||||
return 1;
|
||||
return PyObject_IsTrue(o);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue