[Python-checkins] cpython: implement tp_clear
benjamin.peterson
python-checkins at python.org
Wed Apr 6 00:23:43 CEST 2011
http://hg.python.org/cpython/rev/7b5d09343929
changeset: 69161:7b5d09343929
parent: 69159:a9371cf1cc61
user: Benjamin Peterson <benjamin at python.org>
date: Tue Apr 05 17:25:14 2011 -0500
summary:
implement tp_clear
files:
Modules/_functoolsmodule.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -355,6 +355,15 @@
return 0;
}
+static int
+keyobject_clear(keyobject *ko)
+{
+ Py_CLEAR(ko->cmp);
+ if (ko->object)
+ Py_CLEAR(ko->object);
+ return 0;
+}
+
static PyMemberDef keyobject_members[] = {
{"obj", T_OBJECT,
offsetof(keyobject, object), 0,
@@ -392,7 +401,7 @@
Py_TPFLAGS_DEFAULT, /* tp_flags */
0, /* tp_doc */
(traverseproc)keyobject_traverse, /* tp_traverse */
- 0, /* tp_clear */
+ (inquiry)keyobject_clear, /* tp_clear */
keyobject_richcompare, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list