Skip to content

Commit c05d726

Browse files
authored
Fix compilation under Python 3.9+ (MagicStack#610)
Python 3.9 moved a bunch of GC-related symbols around, including `_PyObject_GC_IS_TRACKED` which is used in `recordobj.c`. Fixes: MagicStack#609
1 parent db4f1a6 commit c05d726

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

asyncpg/protocol/record/recordobj.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
#include "recordobj.h"
1010

11+
#ifdef _PyObject_GC_IS_TRACKED
12+
# define _ApgObject_GC_IS_TRACKED _PyObject_GC_IS_TRACKED
13+
#else
14+
# define _ApgObject_GC_IS_TRACKED PyObject_GC_IsTracked
15+
#endif
1116

1217
static PyObject * record_iter(PyObject *);
1318
static PyObject * record_new_items_iter(PyObject *);
@@ -57,7 +62,7 @@ ApgRecord_New(PyTypeObject *type, PyObject *desc, Py_ssize_t size)
5762
return PyErr_NoMemory();
5863
}
5964
o = (ApgRecordObject *)type->tp_alloc(type, size);
60-
if (!_PyObject_GC_IS_TRACKED(o)) {
65+
if (!_ApgObject_GC_IS_TRACKED(o)) {
6166
PyErr_SetString(
6267
PyExc_TypeError,
6368
"record subclass is not tracked by GC"

0 commit comments

Comments
 (0)