Skip to content

Commit

Permalink
Add an implementation of _PyType_Name for Python 3.6
Browse files Browse the repository at this point in the history
This function was introduced in Python 3.7
(https://bugs.python.org/issue31497).
  • Loading branch information
jparise committed Oct 11, 2022
1 parent db0ea65 commit 943ce12
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions asyncpg/protocol/record/recordobj.c
Expand Up @@ -14,6 +14,21 @@
# define _ApgObject_GC_IS_TRACKED PyObject_GC_IsTracked
#endif

#if PY_VERSION_HEX < 0x03070000
static const char * _PyType_Name(PyTypeObject *type)
{
assert(type->tp_name != NULL);
const char *s = strrchr(type->tp_name, '.');
if (s == NULL) {
s = type->tp_name;
}
else {
s++;
}
return s;
}
#endif

static PyObject * record_iter(PyObject *);
static PyObject * record_new_items_iter(PyObject *);

Expand Down

0 comments on commit 943ce12

Please sign in to comment.