You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.6 KiB

  1. From e9bd383ceb63db7cfe8a284014f0cdf8c2bfe4f0 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Fri, 1 Nov 2019 10:54:11 +0100
  4. Subject: [PATCH] DelayedLink.h: fix build with python 3.8
  5. Fix build with python 3.8 by copy/pasting the vim workaround from
  6. https://github.com/vim/vim/commit/13a1f3fb0c9d08bba6109fe2131c9524e6ba7e15
  7. Fix 3703
  8. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  9. ---
  10. hardware/plugins/DelayedLink.h | 38 ++++++++++++++++++++++++++++++++++
  11. 1 file changed, 38 insertions(+)
  12. diff --git a/hardware/plugins/DelayedLink.h b/hardware/plugins/DelayedLink.h
  13. index 4bf1973281..c90a7d8e69 100644
  14. --- a/hardware/plugins/DelayedLink.h
  15. +++ b/hardware/plugins/DelayedLink.h
  16. @@ -14,6 +14,44 @@
  17. #include <frameobject.h>
  18. #include "../../main/Helper.h"
  19. +#if PY_VERSION_HEX >= 0x030800f0
  20. +static inline void
  21. +py3__Py_DECREF(const char *filename, int lineno, PyObject *op)
  22. +{
  23. + (void)filename; /* may be unused, shut up -Wunused-parameter */
  24. + (void)lineno; /* may be unused, shut up -Wunused-parameter */
  25. + _Py_DEC_REFTOTAL;
  26. + if (--op->ob_refcnt != 0)
  27. + {
  28. +#ifdef Py_REF_DEBUG
  29. + if (op->ob_refcnt < 0)
  30. + {
  31. + _Py_NegativeRefcount(filename, lineno, op);
  32. + }
  33. +#endif
  34. + }
  35. + else
  36. + {
  37. + _Py_Dealloc(op);
  38. + }
  39. +}
  40. +
  41. +#undef Py_DECREF
  42. +#define Py_DECREF(op) py3__Py_DECREF(__FILE__, __LINE__, _PyObject_CAST(op))
  43. +
  44. +static inline void
  45. +py3__Py_XDECREF(PyObject *op)
  46. +{
  47. + if (op != NULL)
  48. + {
  49. + Py_DECREF(op);
  50. + }
  51. +}
  52. +
  53. +#undef Py_XDECREF
  54. +#define Py_XDECREF(op) py3__Py_XDECREF(_PyObject_CAST(op))
  55. +#endif
  56. +
  57. namespace Plugins {
  58. #ifdef WIN32