[Python-checkins] python/dist/src/Objects weakrefobject.c, 1.20, 1.21

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Sun Mar 27 05:04:57 CEST 2005


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6538/Objects

Modified Files:
	weakrefobject.c 
Log Message:
SF bug #1770766:  weakref proxy has incorrect __nonzero__ behavior.

Index: weakrefobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/weakrefobject.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- weakrefobject.c	30 Oct 2004 23:09:22 -0000	1.20
+++ weakrefobject.c	27 Mar 2005 03:04:54 -0000	1.21
@@ -505,11 +505,7 @@
     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



More information about the Python-checkins mailing list