blob: e62fa13ae580f04aacf8f98805f986b2f361bced (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
// Copyright (C) 2018 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef SBKPYTHON_H
#define SBKPYTHON_H
#include "sbkversion.h"
// Qt's "slots" macro collides with the "slots" member variables
// used in some Python structs. For compilers that support push_macro,
// temporarily undefine it.
#if defined(slots) && (defined(__GNUC__) || defined(_MSC_VER) || defined(__clang__))
# pragma push_macro("slots")
# undef slots
/*
* Python 2 has function _Py_Mangle directly in Python.h .
* This creates wrong language binding unless we define 'extern "C"' here.
*/
extern "C" {
/*
* Python 2 uses the "register" keyword, which is deprecated in C++ 11
* and forbidden in C++17.
*/
# if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-register"
# endif
# include <Python.h>
# if defined(__clang__)
# pragma clang diagnostic pop
# endif
}
# include <structmember.h>
// Now we have the usual variables from Python.h .
# include "shibokenmacros.h"
// "pep384impl.h" may nowhere be included but in this file.
# include "pep384impl.h"
# pragma pop_macro("slots")
#else
extern "C" {
/*
* Python 2 uses the "register" keyword, which is deprecated in C++ 11
* and forbidden in C++17.
*/
# if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-register"
# endif
# include <Python.h>
# if defined(__clang__)
# pragma clang diagnostic pop
# endif
}
# include <structmember.h>
// Now we have the usual variables from Python.h .
# include "shibokenmacros.h"
// "pep384impl.h" may nowhere be included but in this file.
# include "pep384impl.h"
#endif
// In Python 3, Py_TPFLAGS_DEFAULT contains Py_TPFLAGS_HAVE_VERSION_TAG,
// which will trigger the attribute cache, which is not intended in Qt for Python.
// Use a customized Py_TPFLAGS_DEFAULT by defining Py_TPFLAGS_HAVE_VERSION_TAG = 0.
#undef Py_TPFLAGS_HAVE_VERSION_TAG
#define Py_TPFLAGS_HAVE_VERSION_TAG (0)
using SbkObjectType [[deprecated]] = PyTypeObject; // FIXME PYSIDE 7 remove
#endif
|