0004-DelayedLink.h-fix-build-with-python-3-8.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. [Retrieved from:
  10. https://github.com/domoticz/domoticz/commit/e9bd383ceb63db7cfe8a284014f0cdf8c2bfe4f0]
  11. ---
  12. hardware/plugins/DelayedLink.h | 38 ++++++++++++++++++++++++++++++++++
  13. 1 file changed, 38 insertions(+)
  14. diff --git a/hardware/plugins/DelayedLink.h b/hardware/plugins/DelayedLink.h
  15. index 4bf1973281..c90a7d8e69 100644
  16. --- a/hardware/plugins/DelayedLink.h
  17. +++ b/hardware/plugins/DelayedLink.h
  18. @@ -14,6 +14,44 @@
  19. #include <frameobject.h>
  20. #include "../../main/Helper.h"
  21. +#if PY_VERSION_HEX >= 0x030800f0
  22. +static inline void
  23. +py3__Py_DECREF(const char *filename, int lineno, PyObject *op)
  24. +{
  25. + (void)filename; /* may be unused, shut up -Wunused-parameter */
  26. + (void)lineno; /* may be unused, shut up -Wunused-parameter */
  27. + _Py_DEC_REFTOTAL;
  28. + if (--op->ob_refcnt != 0)
  29. + {
  30. +#ifdef Py_REF_DEBUG
  31. + if (op->ob_refcnt < 0)
  32. + {
  33. + _Py_NegativeRefcount(filename, lineno, op);
  34. + }
  35. +#endif
  36. + }
  37. + else
  38. + {
  39. + _Py_Dealloc(op);
  40. + }
  41. +}
  42. +
  43. +#undef Py_DECREF
  44. +#define Py_DECREF(op) py3__Py_DECREF(__FILE__, __LINE__, _PyObject_CAST(op))
  45. +
  46. +static inline void
  47. +py3__Py_XDECREF(PyObject *op)
  48. +{
  49. + if (op != NULL)
  50. + {
  51. + Py_DECREF(op);
  52. + }
  53. +}
  54. +
  55. +#undef Py_XDECREF
  56. +#define Py_XDECREF(op) py3__Py_XDECREF(_PyObject_CAST(op))
  57. +#endif
  58. +
  59. namespace Plugins {
  60. #ifdef WIN32