Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(168557)

Unified Diff: Objects/funcobject.c

Issue 11610: Improving property to accept abstract methods
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Objects/descrobject.c ('k') | Objects/object.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Objects/funcobject.c Wed Nov 30 00:25:06 2011 +0200
+++ b/Objects/funcobject.c Wed Dec 07 08:04:02 2011 -0500
@@ -814,6 +814,27 @@
{NULL} /* Sentinel */
};
+static PyObject *
+cm_get___isabstractmethod__(classmethod *cm, void *closure)
+{
+ int res = _PyObject_IsAbstract(cm->cm_callable);
+ if (res == -1) {
+ return NULL;
+ }
+ else if (res) {
+ Py_RETURN_TRUE;
+ }
+ Py_RETURN_FALSE;
+}
+
+static PyGetSetDef cm_getsetlist[] = {
+ {"__isabstractmethod__",
+ (getter)cm_get___isabstractmethod__, NULL,
+ NULL,
+ NULL},
+ {NULL} /* Sentinel */
+};
+
PyDoc_STRVAR(classmethod_doc,
"classmethod(function) -> method\n\
\n\
@@ -865,7 +886,7 @@
0, /* tp_iternext */
0, /* tp_methods */
cm_memberlist, /* tp_members */
- 0, /* tp_getset */
+ cm_getsetlist, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
cm_descr_get, /* tp_descr_get */
@@ -969,6 +990,27 @@
{NULL} /* Sentinel */
};
+static PyObject *
+sm_get___isabstractmethod__(staticmethod *sm, void *closure)
+{
+ int res = _PyObject_IsAbstract(sm->sm_callable);
+ if (res == -1) {
+ return NULL;
+ }
+ else if (res) {
+ Py_RETURN_TRUE;
+ }
+ Py_RETURN_FALSE;
+}
+
+static PyGetSetDef sm_getsetlist[] = {
+ {"__isabstractmethod__",
+ (getter)sm_get___isabstractmethod__, NULL,
+ NULL,
+ NULL},
+ {NULL} /* Sentinel */
+};
+
PyDoc_STRVAR(staticmethod_doc,
"staticmethod(function) -> method\n\
\n\
@@ -1017,7 +1059,7 @@
0, /* tp_iternext */
0, /* tp_methods */
sm_memberlist, /* tp_members */
- 0, /* tp_getset */
+ sm_getsetlist, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
sm_descr_get, /* tp_descr_get */
« no previous file with comments | « Objects/descrobject.c ('k') | Objects/object.c » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+