diff options
author | Guido van Rossum <guido@python.org> | 2002-08-01 14:39:25 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-08-01 14:39:25 (GMT) |
commit | 0dbab4c560c944956e4b732fe33ba0d72a8fb6df (patch) | |
tree | 27dc56338afbf753f5f13e2e74d68f89becf323f /Objects | |
parent | 74824584ef6358eed6fe56cf5513fec5ad9da0da (diff) | |
download | cpython-0dbab4c560c944956e4b732fe33ba0d72a8fb6df.zip cpython-0dbab4c560c944956e4b732fe33ba0d72a8fb6df.tar.gz cpython-0dbab4c560c944956e4b732fe33ba0d72a8fb6df.tar.bz2 |
SF patch 588728 (Nathan Srebro).
The __delete__ method wrapper for descriptors was not supported
(I added a test, too.)
2.2 bugfix candidate.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 6bd2b7a..f7069a0 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2807,6 +2807,22 @@ wrap_descr_set(PyObject *self, PyObject *args, void *wrapped) Py_INCREF(Py_None); return Py_None; } + +static PyObject * +wrap_descr_delete(PyObject *self, PyObject *args, void *wrapped) +{ + descrsetfunc func = (descrsetfunc)wrapped; + PyObject *obj; + int ret; + + if (!PyArg_ParseTuple(args, "O", &obj)) + return NULL; + ret = (*func)(self, obj, NULL); + if (ret < 0) + return NULL; + Py_INCREF(Py_None); + return Py_None; +} static PyObject * wrap_init(PyObject *self, PyObject *args, void *wrapped, PyObject *kwds) @@ -3883,6 +3899,8 @@ static slotdef slotdefs[] = { "descr.__get__(obj[, type]) -> value"), TPSLOT("__set__", tp_descr_set, slot_tp_descr_set, wrap_descr_set, "descr.__set__(obj, value)"), + TPSLOT("__delete__", tp_descr_set, slot_tp_descr_set, + wrap_descr_delete, "descr.__delete__(obj)"), FLSLOT("__init__", tp_init, slot_tp_init, (wrapperfunc)wrap_init, "x.__init__(...) initializes x; " "see x.__class__.__doc__ for signature", |