summaryrefslogtreecommitdiffstats
path: root/Objects/weakrefobject.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-11-19 03:08:32 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-11-19 03:08:32 (GMT)
commit32019774b98d0b140cec1f16e46e4268d0f2cf7f (patch)
tree1d447ddf2f345141c9d0039aa4e14d66b327c2a8 /Objects/weakrefobject.c
parent36c3c027adcc4e92f189edadb5e36f621c3cdf8f (diff)
downloadcpython-32019774b98d0b140cec1f16e46e4268d0f2cf7f.zip
cpython-32019774b98d0b140cec1f16e46e4268d0f2cf7f.tar.gz
cpython-32019774b98d0b140cec1f16e46e4268d0f2cf7f.tar.bz2
fix __bytes__ handling here in py3x
Merged revisions 76395 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r76395 | benjamin.peterson | 2009-11-18 21:00:02 -0600 (Wed, 18 Nov 2009) | 1 line #5037 proxy __unicode__ correctly ........
Diffstat (limited to 'Objects/weakrefobject.c')
-rw-r--r--Objects/weakrefobject.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Objects/weakrefobject.c b/Objects/weakrefobject.c
index 214dd95..27f015d 100644
--- a/Objects/weakrefobject.c
+++ b/Objects/weakrefobject.c
@@ -435,6 +435,13 @@ proxy_checkref(PyWeakReference *proxy)
return generic(proxy, v, w); \
}
+#define WRAP_METHOD(method, special) \
+ static PyObject * \
+ method(PyObject *proxy) { \
+ UNWRAP(proxy); \
+ return PyObject_CallMethod(proxy, special, ""); \
+ }
+
/* direct slots */
@@ -576,6 +583,15 @@ proxy_iternext(PyWeakReference *proxy)
}
+WRAP_METHOD(proxy_bytes, "__bytes__");
+
+
+static PyMethodDef proxy_methods[] = {
+ {"__bytes__", (PyCFunction)proxy_bytes, METH_NOARGS},
+ {NULL, NULL}
+};
+
+
static PyNumberMethods proxy_as_number = {
proxy_add, /*nb_add*/
proxy_sub, /*nb_subtract*/
@@ -661,6 +677,7 @@ _PyWeakref_ProxyType = {
0, /* tp_weaklistoffset */
(getiterfunc)proxy_iter, /* tp_iter */
(iternextfunc)proxy_iternext, /* tp_iternext */
+ proxy_methods, /* tp_methods */
};