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

Unified Diff: Objects/descrobject.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 | « Misc/ACKS ('k') | Objects/funcobject.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Objects/descrobject.c Wed Nov 30 00:25:06 2011 +0200
+++ b/Objects/descrobject.c Wed Dec 07 08:04:02 2011 -0500
@@ -1329,6 +1329,43 @@
return 0;
}
+static PyObject *
+property_get___isabstractmethod__(propertyobject *prop, void *closure)
+{
+ int res = _PyObject_IsAbstract(prop->prop_get);
+ if (res == -1) {
+ return NULL;
+ }
+ else if (res) {
+ Py_RETURN_TRUE;
+ }
+
+ res = _PyObject_IsAbstract(prop->prop_set);
+ if (res == -1) {
+ return NULL;
+ }
+ else if (res) {
+ Py_RETURN_TRUE;
+ }
+
+ res = _PyObject_IsAbstract(prop->prop_del);
+ if (res == -1) {
+ return NULL;
+ }
+ else if (res) {
+ Py_RETURN_TRUE;
+ }
+ Py_RETURN_FALSE;
+}
+
+static PyGetSetDef property_getsetlist[] = {
+ {"__isabstractmethod__",
+ (getter)property_get___isabstractmethod__, NULL,
+ NULL,
+ NULL},
+ {NULL} /* Sentinel */
+};
+
PyDoc_STRVAR(property_doc,
"property(fget=None, fset=None, fdel=None, doc=None) -> property attribute\n"
"\n"
@@ -1394,7 +1431,7 @@
0, /* tp_iternext */
property_methods, /* tp_methods */
property_members, /* tp_members */
- 0, /* tp_getset */
+ property_getsetlist, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
property_descr_get, /* tp_descr_get */
« no previous file with comments | « Misc/ACKS ('k') | Objects/funcobject.c » ('j') | no next file with comments »

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