diff options
author | Armin Rigo <arigo@tunes.org> | 2020-06-02 12:55:49 +0200 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2020-06-02 12:55:49 +0200 |
commit | fc1d60bfb4a1e8ac58126ff4df672d0f8483c721 (patch) | |
tree | 2a6f87c332775ca1ca5798c4e63f6915c76b3385 | |
parent | 82389a693860fa1add7ced57334f9b18c7f04d0e (diff) | |
download | cffi-fc1d60bfb4a1e8ac58126ff4df672d0f8483c721.tar.gz |
Issue #458
py3.10 support
-rw-r--r-- | c/_cffi_backend.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c index 5174648..b3c1c86 100644 --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -111,6 +111,9 @@ # define PyText_InternInPlace PyUnicode_InternInPlace # define PyText_InternFromString PyUnicode_InternFromString # define PyIntOrLong_Check PyLong_Check +# if PY_VERSION_HEX < 0x030900a4 +# define Py_SET_REFCNT(obj, val) (Py_REFCNT(obj) = (val)) +# endif #else # define STR_OR_BYTES "str" # define PyText_Type PyString_Type @@ -404,10 +407,10 @@ ctypedescr_dealloc(CTypeDescrObject *ct) if (ct->ct_unique_key != NULL) { /* revive dead object temporarily for DelItem */ - Py_REFCNT(ct) = 43; + Py_SET_REFCNT(ct, 43); PyDict_DelItem(unique_cache, ct->ct_unique_key); assert(Py_REFCNT(ct) == 42); - Py_REFCNT(ct) = 0; + Py_SET_REFCNT(ct, 0); Py_DECREF(ct->ct_unique_key); } Py_XDECREF(ct->ct_itemdescr); |