diff options
author | Raymond Hettinger <python@rcn.com> | 2005-03-27 03:04:54 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2005-03-27 03:04:54 (GMT) |
commit | e6c470f255b958d65db75e2b9c2416585638b6cf (patch) | |
tree | 0b5737e46e6a0b5451666b4b1505f78fed9cbec4 /Objects/weakrefobject.c | |
parent | ca5d8fea3d1db3ecb914d6c266318e394ee1cb6b (diff) | |
download | cpython-e6c470f255b958d65db75e2b9c2416585638b6cf.zip cpython-e6c470f255b958d65db75e2b9c2416585638b6cf.tar.gz cpython-e6c470f255b958d65db75e2b9c2416585638b6cf.tar.bz2 |
SF bug #1770766: weakref proxy has incorrect __nonzero__ behavior.
Diffstat (limited to 'Objects/weakrefobject.c')
-rw-r--r-- | Objects/weakrefobject.c | 6 |
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 |