mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Convert the ref() and proxy() implementations to use the new
PyArg_UnpackTuple() function (serves as an example and test case).
This commit is contained in:
parent
c84f2c5068
commit
0d429e8cdd
1 changed files with 2 additions and 2 deletions
|
@ -69,7 +69,7 @@ weakref_ref(PyObject *self, PyObject *args)
|
||||||
PyObject *callback = NULL;
|
PyObject *callback = NULL;
|
||||||
PyObject *result = 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);
|
result = PyWeakref_NewRef(object, callback);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -88,7 +88,7 @@ weakref_proxy(PyObject *self, PyObject *args)
|
||||||
PyObject *callback = NULL;
|
PyObject *callback = NULL;
|
||||||
PyObject *result = 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);
|
result = PyWeakref_NewProxy(object, callback);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue