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

Unified Diff: Objects/object.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/funcobject.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Objects/object.c Wed Nov 30 00:25:06 2011 +0200
+++ b/Objects/object.c Wed Dec 07 08:04:02 2011 -0500
@@ -830,6 +830,29 @@
return res;
}
+int
+_PyObject_IsAbstract(PyObject *obj)
+{
+ int res;
+ PyObject* isabstract;
+ _Py_IDENTIFIER(__isabstractmethod__);
+
+ if (obj == NULL)
+ return 0;
+
+ isabstract = _PyObject_GetAttrId(obj, &PyId___isabstractmethod__);
+ if (isabstract == NULL) {
+ if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
+ PyErr_Clear();
+ return 0;
+ }
+ return -1;
+ }
+ res = PyObject_IsTrue(isabstract);
+ Py_DECREF(isabstract);
+ return res;
+}
+
PyObject *
_PyObject_GetAttrId(PyObject *v, _Py_Identifier *name)
{
« no previous file with comments | « Objects/funcobject.c ('k') | no next file » | no next file with comments »

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