Skip to content

Commit e9bd383

Browse files
committed
DelayedLink.h: fix build with python 3.8
Fix build with python 3.8 by copy/pasting the vim workaround from vim/vim@13a1f3f Fix 3703 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
1 parent ff4f7e0 commit e9bd383

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

hardware/plugins/DelayedLink.h

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,44 @@
1414
#include <frameobject.h>
1515
#include "../../main/Helper.h"
1616

17+
#if PY_VERSION_HEX >= 0x030800f0
18+
static inline void
19+
py3__Py_DECREF(const char *filename, int lineno, PyObject *op)
20+
{
21+
(void)filename; /* may be unused, shut up -Wunused-parameter */
22+
(void)lineno; /* may be unused, shut up -Wunused-parameter */
23+
_Py_DEC_REFTOTAL;
24+
if (--op->ob_refcnt != 0)
25+
{
26+
#ifdef Py_REF_DEBUG
27+
if (op->ob_refcnt < 0)
28+
{
29+
_Py_NegativeRefcount(filename, lineno, op);
30+
}
31+
#endif
32+
}
33+
else
34+
{
35+
_Py_Dealloc(op);
36+
}
37+
}
38+
39+
#undef Py_DECREF
40+
#define Py_DECREF(op) py3__Py_DECREF(__FILE__, __LINE__, _PyObject_CAST(op))
41+
42+
static inline void
43+
py3__Py_XDECREF(PyObject *op)
44+
{
45+
if (op != NULL)
46+
{
47+
Py_DECREF(op);
48+
}
49+
}
50+
51+
#undef Py_XDECREF
52+
#define Py_XDECREF(op) py3__Py_XDECREF(_PyObject_CAST(op))
53+
#endif
54+
1755
namespace Plugins {
1856

1957
#ifdef WIN32

0 commit comments

Comments
 (0)