diff options
author | Armin Rigo <arigo@tunes.org> | 2022-04-12 23:29:40 +0200 |
---|---|---|
committer | Armin Rigo <arigo@tunes.org> | 2022-04-12 23:29:40 +0200 |
commit | 2ff7999df707d8d1191553c892519b3791e15341 (patch) | |
tree | f0c52664d0388e7ea994f07df5cd5386fae83a33 /c | |
parent | d784b26f5d79d7cd201d3efd8b573d96b0852967 (diff) | |
download | cffi-2ff7999df707d8d1191553c892519b3791e15341.tar.gz |
#532 Use Py_SET_REFCNT in _cffi_backend.c instead of ob_refcnt
Diffstat (limited to 'c')
-rw-r--r-- | c/_cffi_backend.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c index ce2cacd..4e055f8 100644 --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -4603,7 +4603,7 @@ static PyObject *get_unique_type(CTypeDescrObject *x, array [ctype, length] funcptr [ctresult, ellipsis+abi, num_args, ctargs...] */ - PyObject *key, *y; + PyObject *key, *y, *res; void *pkey; key = PyBytes_FromStringAndSize(NULL, keylength * sizeof(void *)); @@ -4635,8 +4635,9 @@ static PyObject *get_unique_type(CTypeDescrObject *x, /* the 'value' in unique_cache doesn't count as 1, but don't use Py_DECREF(x) here because it will confuse debug builds into thinking there was an extra DECREF in total. */ - ((PyObject *)x)->ob_refcnt--; - return (PyObject *)x; + res = (PyObject *)x; + Py_SET_REFCNT(res, Py_REFCNT(res) - 1); + return res; error: Py_DECREF(x); |