From 9e8448ad5ff8bc0bde69a3c0d7a7264d9533b95d Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Sun, 16 Aug 2020 10:14:03 -0700 Subject: [PATCH 1/2] Fix compilation under Python 3.9+ Python 3.9 moved a bunch of GC-related symbols around, including `_PyObject_GC_IS_TRACKED` which is used in `recordobj.c`. Fixes: #609 --- asyncpg/protocol/record/recordobj.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/asyncpg/protocol/record/recordobj.c b/asyncpg/protocol/record/recordobj.c index de443fce..94567009 100644 --- a/asyncpg/protocol/record/recordobj.c +++ b/asyncpg/protocol/record/recordobj.c @@ -57,7 +57,11 @@ ApgRecord_New(PyTypeObject *type, PyObject *desc, Py_ssize_t size) return PyErr_NoMemory(); } o = (ApgRecordObject *)type->tp_alloc(type, size); +#ifdef _PyObject_GC_IS_TRACKED if (!_PyObject_GC_IS_TRACKED(o)) { +#else + if (!PyObject_GC_IsTracked(o)) { +#endif PyErr_SetString( PyExc_TypeError, "record subclass is not tracked by GC" From d49e9c20e4852e73294063b023c4c3194fd75d27 Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Tue, 18 Aug 2020 12:11:53 -0700 Subject: [PATCH 2/2] Nit --- asyncpg/protocol/record/recordobj.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/asyncpg/protocol/record/recordobj.c b/asyncpg/protocol/record/recordobj.c index 94567009..b734ee9b 100644 --- a/asyncpg/protocol/record/recordobj.c +++ b/asyncpg/protocol/record/recordobj.c @@ -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 *); @@ -57,11 +62,7 @@ ApgRecord_New(PyTypeObject *type, PyObject *desc, Py_ssize_t size) return PyErr_NoMemory(); } o = (ApgRecordObject *)type->tp_alloc(type, size); -#ifdef _PyObject_GC_IS_TRACKED - if (!_PyObject_GC_IS_TRACKED(o)) { -#else - if (!PyObject_GC_IsTracked(o)) { -#endif + if (!_ApgObject_GC_IS_TRACKED(o)) { PyErr_SetString( PyExc_TypeError, "record subclass is not tracked by GC" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy