comparison src/if_python3.c @ 18414:6b8508ea90d7 v8.1.2201

patch 8.1.2201: cannot build with dynamically linked Python 3.8 Commit: https://github.com/vim/vim/commit/13a1f3fb0c9d08bba6109fe2131c9524e6ba7e15 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Oct 23 21:37:25 2019 +0200 patch 8.1.2201: cannot build with dynamically linked Python 3.8 Problem: Cannot build with dynamically linked Python 3.8. Solution: Implement py3__Py_DECREF() and py3__Py_XDECREF(). (Ken Takata, closes #4080)
author Bram Moolenaar <Bram@vim.org>
date Wed, 23 Oct 2019 21:45:03 +0200
parents ce04ebdf26b8
children f0f9692d4487
comparison
equal deleted inserted replaced
18413:90aa634b3bff 18414:6b8508ea90d7
598 {"PyCapsule_New", (PYTHON_PROC*)&py3_PyCapsule_New}, 598 {"PyCapsule_New", (PYTHON_PROC*)&py3_PyCapsule_New},
599 {"PyCapsule_GetPointer", (PYTHON_PROC*)&py3_PyCapsule_GetPointer}, 599 {"PyCapsule_GetPointer", (PYTHON_PROC*)&py3_PyCapsule_GetPointer},
600 {"", NULL}, 600 {"", NULL},
601 }; 601 };
602 602
603 # if PY_VERSION_HEX >= 0x030800f0
604 static inline void
605 py3__Py_DECREF(const char *filename UNUSED, int lineno UNUSED, PyObject *op)
606 {
607 _Py_DEC_REFTOTAL;
608 if (--op->ob_refcnt != 0)
609 {
610 # ifdef Py_REF_DEBUG
611 if (op->ob_refcnt < 0)
612 {
613 _Py_NegativeRefcount(filename, lineno, op);
614 }
615 # endif
616 }
617 else
618 {
619 _Py_Dealloc(op);
620 }
621 }
622
623 # undef Py_DECREF
624 # define Py_DECREF(op) py3__Py_DECREF(__FILE__, __LINE__, _PyObject_CAST(op))
625
626 static inline void
627 py3__Py_XDECREF(PyObject *op)
628 {
629 if (op != NULL)
630 {
631 Py_DECREF(op);
632 }
633 }
634
635 # undef Py_XDECREF
636 # define Py_XDECREF(op) py3__Py_XDECREF(_PyObject_CAST(op))
637 # endif
638
603 /* 639 /*
604 * Free python.dll 640 * Free python.dll
605 */ 641 */
606 static void 642 static void
607 end_dynamic_python3(void) 643 end_dynamic_python3(void)