.. c:function:: int PyDescr_IsData(PyObject *descr)
- Return true if the descriptor objects *descr* describes a data attribute, or
- false if it describes a method. *descr* must be a descriptor object; there is
+ Return non-zero if the descriptor objects *descr* describes a data attribute, or
+ ``0`` if it describes a method. *descr* must be a descriptor object; there is
no error checking.
#ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
struct wrapperbase *, void *);
-#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL)
+PyAPI_FUNC(int) PyDescr_IsData(PyObject *);
#endif
PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
--- /dev/null
+Convert :c:func:`PyDescr_IsData` macro to a function to hide implementation
+details: The macro accessed :c:member:`PyTypeObject.tp_descr_set` directly.
+Patch by Erlend E. Aasland.
return (PyObject *)descr;
}
+int
+PyDescr_IsData(PyObject *ob)
+{
+ return Py_TYPE(ob)->tp_descr_set != NULL;
+}
/* --- mappingproxy: read-only proxy for mappings --- */