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

Delta Between Two Patch Sets: Objects/descrobject.c

Issue 11610: Improving property to accept abstract methods
Left Patch Set: Created 8 years ago
Right Patch Set: Created 8 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Misc/ACKS ('k') | Objects/funcobject.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* Descriptors -- a new, flexible way to describe attributes */ 1 /* Descriptors -- a new, flexible way to describe attributes */
2 2
3 #include "Python.h" 3 #include "Python.h"
4 #include "structmember.h" /* Why is this not included in Python.h? */ 4 #include "structmember.h" /* Why is this not included in Python.h? */
5 5
6 static void 6 static void
7 descr_dealloc(PyDescrObject *descr) 7 descr_dealloc(PyDescrObject *descr)
8 { 8 {
9 _PyObject_GC_UNTRACK(descr); 9 _PyObject_GC_UNTRACK(descr);
10 Py_XDECREF(descr->d_type); 10 Py_XDECREF(descr->d_type);
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 } 1326 }
1327 } 1327 }
1328 1328
1329 return 0; 1329 return 0;
1330 } 1330 }
1331 1331
1332 static PyObject * 1332 static PyObject *
1333 property_get___isabstractmethod__(propertyobject *prop, void *closure) 1333 property_get___isabstractmethod__(propertyobject *prop, void *closure)
1334 { 1334 {
1335 int res = _PyObject_IsAbstract(prop->prop_get); 1335 int res = _PyObject_IsAbstract(prop->prop_get);
1336 if (res == -1) 1336 if (res == -1) {
Nick Coghlan 2011/12/06 09:14:01 Include K&R style braces here (e.g. see the style
dsdale24 2011/12/06 14:52:52 "That ditch is Boss Kean's ditch. And I told him t
1337 return NULL; 1337 return NULL;
1338 else if (res) 1338 }
1339 else if (res) {
1339 Py_RETURN_TRUE; 1340 Py_RETURN_TRUE;
1341 }
1340 1342
1341 res = _PyObject_IsAbstract(prop->prop_set); 1343 res = _PyObject_IsAbstract(prop->prop_set);
1342 if (res == -1) 1344 if (res == -1) {
1343 return NULL; 1345 return NULL;
1344 else if (res) 1346 }
1347 else if (res) {
1345 Py_RETURN_TRUE; 1348 Py_RETURN_TRUE;
1349 }
1346 1350
1347 res = _PyObject_IsAbstract(prop->prop_del); 1351 res = _PyObject_IsAbstract(prop->prop_del);
1348 if (res == -1) 1352 if (res == -1) {
1349 return NULL; 1353 return NULL;
1350 else if (res) 1354 }
1355 else if (res) {
1351 Py_RETURN_TRUE; 1356 Py_RETURN_TRUE;
1352 1357 }
1353 Py_RETURN_FALSE; 1358 Py_RETURN_FALSE;
1354 } 1359 }
1355 1360
1356 static PyGetSetDef property_getsetlist[] = { 1361 static PyGetSetDef property_getsetlist[] = {
1357 {"__isabstractmethod__", 1362 {"__isabstractmethod__",
1358 (getter)property_get___isabstractmethod__, NULL, 1363 (getter)property_get___isabstractmethod__, NULL,
1359 NULL, 1364 NULL,
1360 NULL}, 1365 NULL},
1361 {NULL} /* Sentinel */ 1366 {NULL} /* Sentinel */
1362 }; 1367 };
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 0, /* tp_base */ 1435 0, /* tp_base */
1431 0, /* tp_dict */ 1436 0, /* tp_dict */
1432 property_descr_get, /* tp_descr_get */ 1437 property_descr_get, /* tp_descr_get */
1433 property_descr_set, /* tp_descr_set */ 1438 property_descr_set, /* tp_descr_set */
1434 0, /* tp_dictoffset */ 1439 0, /* tp_dictoffset */
1435 property_init, /* tp_init */ 1440 property_init, /* tp_init */
1436 PyType_GenericAlloc, /* tp_alloc */ 1441 PyType_GenericAlloc, /* tp_alloc */
1437 PyType_GenericNew, /* tp_new */ 1442 PyType_GenericNew, /* tp_new */
1438 PyObject_GC_Del, /* tp_free */ 1443 PyObject_GC_Del, /* tp_free */
1439 }; 1444 };
LEFTRIGHT

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