summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2005-03-31 04:07:55 (GMT)
committerRaymond Hettinger <python@rcn.com>2005-03-31 04:07:55 (GMT)
commit4cf27049b68a2c1dca643638f319966ba3fae4ee (patch)
tree8778069ea28c8c6fb9cbcd0aef60ef347c90a887 /Objects
parentb7f4c2d03af4c7d3960df64b7ae4139520c9fdcf (diff)
downloadcpython-4cf27049b68a2c1dca643638f319966ba3fae4ee.zip
cpython-4cf27049b68a2c1dca643638f319966ba3fae4ee.tar.gz
cpython-4cf27049b68a2c1dca643638f319966ba3fae4ee.tar.bz2
SF bug #1770766: weakref proxy has incorrect __nonzero__ behavior.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/weakrefobject.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index 02370c4..5412dd3 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -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