]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Convert the ref() and proxy() implementations to use the new
authorFred Drake <fdrake@acm.org>
Tue, 23 Oct 2001 21:12:47 +0000 (21:12 +0000)
committerFred Drake <fdrake@acm.org>
Tue, 23 Oct 2001 21:12:47 +0000 (21:12 +0000)
PyArg_UnpackTuple() function (serves as an example and test case).

Modules/_weakref.c

index 79873372b43da3a98460691f2648e5e50c5f89dc..f797fbf00e7d8499530c420d37e42a8eceb32b1e 100644 (file)
@@ -69,7 +69,7 @@ weakref_ref(PyObject *self, PyObject *args)
     PyObject *callback = NULL;
     PyObject *result = NULL;
 
-    if (PyArg_ParseTuple(args, "O|O:ref", &object, &callback)) {
+    if (PyArg_UnpackTuple(args, "ref", 1, 2, &object, &callback)) {
         result = PyWeakref_NewRef(object, callback);
     }
     return result;
@@ -88,7 +88,7 @@ weakref_proxy(PyObject *self, PyObject *args)
     PyObject *callback = NULL;
     PyObject *result = NULL;
 
-    if (PyArg_ParseTuple(args, "O|O:new", &object, &callback)) {
+    if (PyArg_UnpackTuple(args, "proxy", 1, 2, &object, &callback)) {
         result = PyWeakref_NewProxy(object, callback);
     }
     return result;