Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 492b46f

Browse files
committed
Make PyDescr_IsData() a macro. It's too simple to be a function.
Should save 4% on slot lookups.
1 parent 69734a5 commit 492b46f

2 files changed

Lines changed: 1 addition & 7 deletions

File tree

Include/descrobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *,
7676
struct PyGetSetDef *);
7777
PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *,
7878
struct wrapperbase *, void *);
79-
PyAPI_FUNC(int) PyDescr_IsData(PyObject *);
79+
#define PyDescr_IsData(d) ((d)->ob_type->tp_descr_set != NULL)
8080

8181
PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *);
8282
PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *);

Objects/descrobject.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -555,12 +555,6 @@ PyDescr_NewWrapper(PyTypeObject *type, struct wrapperbase *base, void *wrapped)
555555
return (PyObject *)descr;
556556
}
557557

558-
int
559-
PyDescr_IsData(PyObject *d)
560-
{
561-
return d->ob_type->tp_descr_set != NULL;
562-
}
563-
564558

565559
/* --- Readonly proxy for dictionaries (actually any mapping) --- */
566560

0 commit comments

Comments
 (0)