improve abstract property support (closes #11610)
Thanks to Darren Dale for patch.
diff --git a/Objects/object.c b/Objects/object.c
index ad31738..9060c82 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -840,6 +840,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)
{