mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-40170: Convert PyDescr_IsData() to static inline function (GH-24535)
This commit is contained in:
parent
8a8b5df93f
commit
871eb4237b
4 changed files with 11 additions and 3 deletions
|
@ -32,8 +32,8 @@ found in the dictionary of type objects.
|
||||||
|
|
||||||
.. c:function:: int PyDescr_IsData(PyObject *descr)
|
.. c:function:: int PyDescr_IsData(PyObject *descr)
|
||||||
|
|
||||||
Return true if the descriptor objects *descr* describes a data attribute, or
|
Return non-zero if the descriptor objects *descr* describes a data attribute, or
|
||||||
false if it describes a method. *descr* must be a descriptor object; there is
|
``0`` if it describes a method. *descr* must be a descriptor object; there is
|
||||||
no error checking.
|
no error checking.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
|
||||||
#ifndef Py_LIMITED_API
|
#ifndef Py_LIMITED_API
|
||||||
PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
|
PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
|
||||||
struct wrapperbase *, void *);
|
struct wrapperbase *, void *);
|
||||||
#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL)
|
PyAPI_FUNC(int) PyDescr_IsData(PyObject *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
|
PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
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.
|
|
@ -995,6 +995,11 @@ PyDescr_NewWrapper(PyTypeObject *type, struct wrapperbase *base, void *wrapped)
|
||||||
return (PyObject *)descr;
|
return (PyObject *)descr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
PyDescr_IsData(PyObject *ob)
|
||||||
|
{
|
||||||
|
return Py_TYPE(ob)->tp_descr_set != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* --- mappingproxy: read-only proxy for mappings --- */
|
/* --- mappingproxy: read-only proxy for mappings --- */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue