From 4c2bc52fa08867b2cc643252e68bb3f7b46b5528 Mon Sep 17 00:00:00 2001 From: Igor Malinovskiy Date: Wed, 5 Jun 2019 17:38:51 +0300 Subject: [PATCH] Use python.h wrapping to allow embedding as-is in any Qt-based project --- src/ensure_gil_state.h | 2 +- src/pyglarea.h | 2 +- src/pyglrenderer.h | 2 +- src/pyobject_converter.h | 2 +- src/pyobject_ref.h | 2 +- src/pyqobject.h | 2 +- src/python_wrap.h | 6 ++++++ src/qpython.h | 2 +- src/qpython_priv.h | 2 +- 9 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 src/python_wrap.h diff --git a/src/ensure_gil_state.h b/src/ensure_gil_state.h index 19738aa..07b0689 100644 --- a/src/ensure_gil_state.h +++ b/src/ensure_gil_state.h @@ -17,7 +17,7 @@ * PERFORMANCE OF THIS SOFTWARE. **/ -#include "Python.h" +#include "python_wrap.h" class EnsureGILState { public: diff --git a/src/pyglarea.h b/src/pyglarea.h index 864849d..dfe47b0 100644 --- a/src/pyglarea.h +++ b/src/pyglarea.h @@ -19,7 +19,7 @@ #ifndef PYOTHERSIDE_PYGLAREA_H #define PYOTHERSIDE_PYGLAREA_H -#include "Python.h" +#include "python_wrap.h" #include #include diff --git a/src/pyglrenderer.h b/src/pyglrenderer.h index 92e2653..4b26b4c 100644 --- a/src/pyglrenderer.h +++ b/src/pyglrenderer.h @@ -19,7 +19,7 @@ #ifndef PYOTHERSIDE_PYGLRENDERER_H #define PYOTHERSIDE_PYGLRENDERER_H -#include "Python.h" +#include "python_wrap.h" #include #include diff --git a/src/pyobject_converter.h b/src/pyobject_converter.h index 35fb71d..061ab8a 100644 --- a/src/pyobject_converter.h +++ b/src/pyobject_converter.h @@ -22,7 +22,7 @@ #include "converter.h" #include "pyqobject.h" -#include "Python.h" +#include "python_wrap.h" #include "datetime.h" #include diff --git a/src/pyobject_ref.h b/src/pyobject_ref.h index efd5d14..2ed9ae8 100644 --- a/src/pyobject_ref.h +++ b/src/pyobject_ref.h @@ -20,7 +20,7 @@ #ifndef PYOTHERSIDE_PYOBJECT_REF_H #define PYOTHERSIDE_PYOBJECT_REF_H -#include "Python.h" +#include "python_wrap.h" #include diff --git a/src/pyqobject.h b/src/pyqobject.h index e42518b..3be31d9 100644 --- a/src/pyqobject.h +++ b/src/pyqobject.h @@ -19,7 +19,7 @@ #ifndef PYOTHERSIDE_PYQOBJECT_H #define PYOTHERSIDE_PYQOBJECT_H -#include "Python.h" +#include "python_wrap.h" #include "qobject_ref.h" diff --git a/src/python_wrap.h b/src/python_wrap.h new file mode 100644 index 0000000..239806e --- /dev/null +++ b/src/python_wrap.h @@ -0,0 +1,6 @@ +#pragma once + +#pragma push_macro("slots") +#undef slots +#include "Python.h" +#pragma pop_macro("slots") diff --git a/src/qpython.h b/src/qpython.h index 04ed3fa..5980ecd 100644 --- a/src/qpython.h +++ b/src/qpython.h @@ -19,7 +19,7 @@ #ifndef PYOTHERSIDE_QPYTHON_H #define PYOTHERSIDE_QPYTHON_H -#include "Python.h" +#include "python_wrap.h" #include #include diff --git a/src/qpython_priv.h b/src/qpython_priv.h index 256e138..140385d 100644 --- a/src/qpython_priv.h +++ b/src/qpython_priv.h @@ -19,7 +19,7 @@ #ifndef PYOTHERSIDE_QPYTHON_PRIV_H #define PYOTHERSIDE_QPYTHON_PRIV_H -#include "Python.h" +#include "python_wrap.h" #include "pyobject_ref.h" #include "pyqobject.h"