Skip to content

Commit c343350

Browse files
committed
py_compat: Add PyType_GetName and PyType_GetQualName
1 parent b16b0e0 commit c343350

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/interrogatedb/py_compat.h

+12
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,18 @@ ALWAYS_INLINE PyObject *Py_XNewRef(PyObject *obj) {
281281
}
282282
#endif
283283

284+
/* Python 3.11 */
285+
286+
#if PY_VERSION_HEX < 0x030B0000
287+
INLINE PyObject *PyType_GetName(PyTypeObject *type) {
288+
return PyObject_GetAttrString((PyObject *)type, "__name__");
289+
}
290+
291+
INLINE PyObject *PyType_GetQualName(PyTypeObject *type) {
292+
return PyObject_GetAttrString((PyObject *)type, "__qualname__");
293+
}
294+
#endif
295+
284296
/* Python 3.12 */
285297

286298
#if PY_VERSION_HEX < 0x030C0000

0 commit comments

Comments
 (0)