Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/greenlet/PyGreenlet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ _green_dealloc_kill_started_non_main_greenlet(BorrowedGreenlet self)

PyObject_GC_Track((PyObject*)self);

_Py_DEC_REFTOTAL;
GREENLET_Py_DEC_REFTOTAL;
#ifdef COUNT_ALLOCS
--Py_TYPE(self)->tp_frees;
--Py_TYPE(self)->tp_allocs;
Expand Down
10 changes: 6 additions & 4 deletions src/greenlet/greenlet_cpython_compat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,22 @@ Greenlet won't compile on anything older than Python 3.11 alpha 4 (see
# define Py_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
#endif

#ifndef _Py_DEC_REFTOTAL
#ifdef _Py_DEC_REFTOTAL
# define GREENLET_Py_DEC_REFTOTAL _Py_DEC_REFTOTAL
#else
/* _Py_DEC_REFTOTAL macro has been removed from Python 3.9 by:
https://github.com/python/cpython/commit/49932fec62c616ec88da52642339d83ae719e924

The symbol we use to replace it was removed by at least 3.12.
*/
# ifdef Py_REF_DEBUG
# if GREENLET_PY312
# define _Py_DEC_REFTOTAL
# define GREENLET_Py_DEC_REFTOTAL
# else
# define _Py_DEC_REFTOTAL _Py_RefTotal--
# define GREENLET_Py_DEC_REFTOTAL _Py_RefTotal--
# endif
# else
# define _Py_DEC_REFTOTAL
# define GREENLET_Py_DEC_REFTOTAL
# endif
#endif
// Define these flags like Cython does if we're on an old version.
Expand Down
Loading