Skip to content

Commit 2cf6751

Browse files
committed
Add an implementation of _PyType_Name for Python 3.6
This function was introduced in Python 3.7 (https://bugs.python.org/issue31497).
1 parent 8598671 commit 2cf6751

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

asyncpg/protocol/record/recordobj.c

+15
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@
1414
# define _ApgObject_GC_IS_TRACKED PyObject_GC_IsTracked
1515
#endif
1616

17+
#if PY_VERSION_HEX < 0x03070000
18+
static const char * _PyType_Name(PyTypeObject *type)
19+
{
20+
assert(type->tp_name != NULL);
21+
const char *s = strrchr(type->tp_name, '.');
22+
if (s == NULL) {
23+
s = type->tp_name;
24+
}
25+
else {
26+
s++;
27+
}
28+
return s;
29+
}
30+
#endif
31+
1732
static PyObject * record_iter(PyObject *);
1833
static PyObject * record_new_items_iter(PyObject *);
1934

0 commit comments

Comments
 (0)