summaryrefslogtreecommitdiffstats
path: root/Objects/weakrefobject.c
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2004-02-03 19:52:56 (GMT)
committerFred Drake <fdrake@acm.org>2004-02-03 19:52:56 (GMT)
commit6a2852cd48fbe4164c6a6eec95a086e8630dde45 (patch)
treeba61adc4af5676baf95cfb43fc47a7863e40edc7 /Objects/weakrefobject.c
parent4458ece4d7661ff3c76aea044779b7d235774cbb (diff)
downloadcpython-6a2852cd48fbe4164c6a6eec95a086e8630dde45.zip
cpython-6a2852cd48fbe4164c6a6eec95a086e8630dde45.tar.gz
cpython-6a2852cd48fbe4164c6a6eec95a086e8630dde45.tar.bz2
Fix bug in interpretation of the "callback" argument in the constructors for
weakref ref and proxy objects; None was not being treated as identical to NULL, though it was documented as equivalent.
Diffstat (limited to 'Objects/weakrefobject.c')
-rw-r--r--Objects/weakrefobject.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index db1f8d1..cf0316a 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -624,7 +624,9 @@ PyWeakref_NewRef(PyObject *ob, PyObject *callback)
}
list = GET_WEAKREFS_LISTPTR(ob);
get_basic_refs(*list, &ref, &proxy);
- if (callback == NULL || callback == Py_None)
+ if (callback == Py_None)
+ callback = NULL;
+ if (callback == NULL)
/* return existing weak reference if it exists */
result = ref;
if (result != NULL)
@@ -664,6 +666,8 @@ PyWeakref_NewProxy(PyObject *ob, PyObject *callback)
}
list = GET_WEAKREFS_LISTPTR(ob);
get_basic_refs(*list, &ref, &proxy);
+ if (callback == Py_None)
+ callback = NULL;
if (callback == NULL)
/* attempt to return an existing weak reference if it exists */
result = proxy;