]> granicus.if.org Git - vim/commitdiff
patch 8.1.2201: cannot build with dynamically linked Python 3.8 v8.1.2201
authorBram Moolenaar <Bram@vim.org>
Wed, 23 Oct 2019 19:37:25 +0000 (21:37 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 23 Oct 2019 19:37:25 +0000 (21:37 +0200)
Problem:    Cannot build with dynamically linked Python 3.8.
Solution:   Implement py3__Py_DECREF() and py3__Py_XDECREF(). (Ken Takata,
            closes #4080)

src/if_python3.c
src/version.c

index b0b11526e671839ffda0adbbd004d9d07ee19842..26b973b9c0246fbe2a6e0ca2acfb5589c4877fd4 100644 (file)
@@ -600,6 +600,42 @@ static struct
     {"", NULL},
 };
 
+# if PY_VERSION_HEX >= 0x030800f0
+    static inline void
+py3__Py_DECREF(const char *filename UNUSED, int lineno UNUSED, PyObject *op)
+{
+    _Py_DEC_REFTOTAL;
+    if (--op->ob_refcnt != 0)
+    {
+#  ifdef Py_REF_DEBUG
+       if (op->ob_refcnt < 0)
+       {
+           _Py_NegativeRefcount(filename, lineno, op);
+       }
+#  endif
+    }
+    else
+    {
+       _Py_Dealloc(op);
+    }
+}
+
+#  undef Py_DECREF
+#  define Py_DECREF(op) py3__Py_DECREF(__FILE__, __LINE__, _PyObject_CAST(op))
+
+    static inline void
+py3__Py_XDECREF(PyObject *op)
+{
+    if (op != NULL)
+    {
+       Py_DECREF(op);
+    }
+}
+
+#  undef Py_XDECREF
+#  define Py_XDECREF(op) py3__Py_XDECREF(_PyObject_CAST(op))
+# endif
+
 /*
  * Free python.dll
  */
index 60a690dec742b27e8ae4cd3e7204da205d21ad1c..c2c5584b497e2b64f13bfad3ac657e1901bcbcc9 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2201,
 /**/
     2200,
 /**/