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

Delta Between Two Patch Sets: Objects/funcobject.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 | « Objects/descrobject.c ('k') | Objects/object.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 1
2 /* Function object implementation */ 2 /* Function object implementation */
3 3
4 #include "Python.h" 4 #include "Python.h"
5 #include "code.h" 5 #include "code.h"
6 #include "structmember.h" 6 #include "structmember.h"
7 7
8 PyObject * 8 PyObject *
9 PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname ) 9 PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname )
10 { 10 {
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 811
812 static PyMemberDef cm_memberlist[] = { 812 static PyMemberDef cm_memberlist[] = {
813 {"__func__", T_OBJECT, offsetof(classmethod, cm_callable), READONLY}, 813 {"__func__", T_OBJECT, offsetof(classmethod, cm_callable), READONLY},
814 {NULL} /* Sentinel */ 814 {NULL} /* Sentinel */
815 }; 815 };
816 816
817 static PyObject * 817 static PyObject *
818 cm_get___isabstractmethod__(classmethod *cm, void *closure) 818 cm_get___isabstractmethod__(classmethod *cm, void *closure)
819 { 819 {
820 int res = _PyObject_IsAbstract(cm->cm_callable); 820 int res = _PyObject_IsAbstract(cm->cm_callable);
821 if (res == -1) 821 if (res == -1) {
Nick Coghlan 2011/12/06 09:14:01 Always use the braces when there are multiple clau
822 return NULL; 822 return NULL;
823 else if (res) 823 }
824 else if (res) {
824 Py_RETURN_TRUE; 825 Py_RETURN_TRUE;
825 826 }
826 Py_RETURN_FALSE; 827 Py_RETURN_FALSE;
827 } 828 }
828 829
829 static PyGetSetDef cm_getsetlist[] = { 830 static PyGetSetDef cm_getsetlist[] = {
830 {"__isabstractmethod__", 831 {"__isabstractmethod__",
831 (getter)cm_get___isabstractmethod__, NULL, 832 (getter)cm_get___isabstractmethod__, NULL,
832 NULL, 833 NULL,
833 NULL}, 834 NULL},
834 {NULL} /* Sentinel */ 835 {NULL} /* Sentinel */
835 }; 836 };
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 987
987 static PyMemberDef sm_memberlist[] = { 988 static PyMemberDef sm_memberlist[] = {
988 {"__func__", T_OBJECT, offsetof(staticmethod, sm_callable), READONLY}, 989 {"__func__", T_OBJECT, offsetof(staticmethod, sm_callable), READONLY},
989 {NULL} /* Sentinel */ 990 {NULL} /* Sentinel */
990 }; 991 };
991 992
992 static PyObject * 993 static PyObject *
993 sm_get___isabstractmethod__(staticmethod *sm, void *closure) 994 sm_get___isabstractmethod__(staticmethod *sm, void *closure)
994 { 995 {
995 int res = _PyObject_IsAbstract(sm->sm_callable); 996 int res = _PyObject_IsAbstract(sm->sm_callable);
996 if (res == -1) 997 if (res == -1) {
Nick Coghlan 2011/12/06 09:14:01 Braces
997 return NULL; 998 return NULL;
998 else if (res) 999 }
1000 else if (res) {
999 Py_RETURN_TRUE; 1001 Py_RETURN_TRUE;
1000 1002 }
1001 Py_RETURN_FALSE; 1003 Py_RETURN_FALSE;
1002 } 1004 }
1003 1005
1004 static PyGetSetDef sm_getsetlist[] = { 1006 static PyGetSetDef sm_getsetlist[] = {
1005 {"__isabstractmethod__", 1007 {"__isabstractmethod__",
1006 (getter)sm_get___isabstractmethod__, NULL, 1008 (getter)sm_get___isabstractmethod__, NULL,
1007 NULL, 1009 NULL,
1008 NULL}, 1010 NULL},
1009 {NULL} /* Sentinel */ 1011 {NULL} /* Sentinel */
1010 }; 1012 };
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 PyStaticMethod_New(PyObject *callable) 1075 PyStaticMethod_New(PyObject *callable)
1074 { 1076 {
1075 staticmethod *sm = (staticmethod *) 1077 staticmethod *sm = (staticmethod *)
1076 PyType_GenericAlloc(&PyStaticMethod_Type, 0); 1078 PyType_GenericAlloc(&PyStaticMethod_Type, 0);
1077 if (sm != NULL) { 1079 if (sm != NULL) {
1078 Py_INCREF(callable); 1080 Py_INCREF(callable);
1079 sm->sm_callable = callable; 1081 sm->sm_callable = callable;
1080 } 1082 }
1081 return (PyObject *)sm; 1083 return (PyObject *)sm;
1082 } 1084 }
LEFTRIGHT

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