Skip to content

Commit

Permalink
Fix compilation under Python 3.9+ (#610)
Browse files Browse the repository at this point in the history
Python 3.9 moved a bunch of GC-related symbols around, including
`_PyObject_GC_IS_TRACKED` which is used in `recordobj.c`.

Fixes: #609
  • Loading branch information
elprans committed Aug 19, 2020
1 parent db4f1a6 commit c05d726
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion asyncpg/protocol/record/recordobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

#include "recordobj.h"

#ifdef _PyObject_GC_IS_TRACKED
# define _ApgObject_GC_IS_TRACKED _PyObject_GC_IS_TRACKED
#else
# define _ApgObject_GC_IS_TRACKED PyObject_GC_IsTracked
#endif

static PyObject * record_iter(PyObject *);
static PyObject * record_new_items_iter(PyObject *);
Expand Down Expand Up @@ -57,7 +62,7 @@ ApgRecord_New(PyTypeObject *type, PyObject *desc, Py_ssize_t size)
return PyErr_NoMemory();
}
o = (ApgRecordObject *)type->tp_alloc(type, size);
if (!_PyObject_GC_IS_TRACKED(o)) {
if (!_ApgObject_GC_IS_TRACKED(o)) {
PyErr_SetString(
PyExc_TypeError,
"record subclass is not tracked by GC"
Expand Down

0 comments on commit c05d726

Please sign in to comment.