summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2014-08-06 23:31:40 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2014-08-06 23:31:40 (GMT)
commitb349e4c929131eb708ff3db569077f0c851338e9 (patch)
tree3d5b5e89bcc0f2c55587459d3bc91ee34a94d74b /Modules
parentf3440c6881a0fdb24ea30f971ebc0fd091bc7ffb (diff)
downloadcpython-b349e4c929131eb708ff3db569077f0c851338e9.zip
cpython-b349e4c929131eb708ff3db569077f0c851338e9.tar.gz
cpython-b349e4c929131eb708ff3db569077f0c851338e9.tar.bz2
Issue #22116: C functions and methods (of the 'builtin_function_or_method' type) can now be weakref'ed. Patch by Wei Wu.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_testcapimodule.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index ebbf88f..9f20abb 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -2653,6 +2653,21 @@ with_tp_del(PyObject *self, PyObject *args)
return obj;
}
+static PyMethodDef ml;
+
+static PyObject *
+create_cfunction(PyObject *self, PyObject *args)
+{
+ return PyCFunction_NewEx(&ml, self, NULL);
+}
+
+static PyMethodDef ml = {
+ "create_cfunction",
+ create_cfunction,
+ METH_NOARGS,
+ NULL
+};
+
static PyObject *
_test_incref(PyObject *ob)
{
@@ -3186,6 +3201,7 @@ static PyMethodDef TestMethods[] = {
{"pytime_object_to_timeval", test_pytime_object_to_timeval, METH_VARARGS},
{"pytime_object_to_timespec", test_pytime_object_to_timespec, METH_VARARGS},
{"with_tp_del", with_tp_del, METH_VARARGS},
+ {"create_cfunction", create_cfunction, METH_NOARGS},
{"test_pymem_alloc0",
(PyCFunction)test_pymem_alloc0, METH_NOARGS},
{"test_pymem_setrawallocators",