aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sources/shiboken6/generator/shiboken/shibokengenerator.cpp8
-rw-r--r--sources/shiboken6/libshiboken/CMakeLists.txt2
-rw-r--r--sources/shiboken6/libshiboken/pep384impl.h1
-rw-r--r--sources/shiboken6/libshiboken/pep384impl_doc.rst1
-rw-r--r--sources/shiboken6/libshiboken/sbkconverter.h10
-rw-r--r--sources/shiboken6/libshiboken/sbkenum.cpp12
-rw-r--r--sources/shiboken6/libshiboken/sbkenum_p.h53
-rw-r--r--testing/__init__.py5
8 files changed, 74 insertions, 18 deletions
diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
index 8935fa162..233b95776 100644
--- a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
@@ -784,8 +784,12 @@ QString ShibokenGenerator::converterObject(const TypeEntry *type)
{
if (type->isExtendedCppPrimitive())
return QString::fromLatin1("Shiboken::Conversions::PrimitiveTypeConverter<%1>()").arg(type->qualifiedCppName());
- if (type->isWrapperType() || type->isEnum() || type->isFlags())
- return QString::fromLatin1("*PepType_SGTP(%1)->converter").arg(cpythonTypeNameExt(type));
+ if (type->isWrapperType())
+ return QString::fromLatin1("PepType_SOTP(%1)->converter").arg(cpythonTypeNameExt(type));
+ if (type->isEnum())
+ return QString::fromLatin1("PepType_SETP(%1)->converter").arg(cpythonTypeNameExt(type));
+ if (type->isFlags())
+ return QString::fromLatin1("PepType_PFTP(%1)->converter").arg(cpythonTypeNameExt(type));
if (type->isArray()) {
qDebug() << "Warning: no idea how to handle the Qt5 type " << type->qualifiedCppName();
diff --git a/sources/shiboken6/libshiboken/CMakeLists.txt b/sources/shiboken6/libshiboken/CMakeLists.txt
index 02be441f9..2a07150ff 100644
--- a/sources/shiboken6/libshiboken/CMakeLists.txt
+++ b/sources/shiboken6/libshiboken/CMakeLists.txt
@@ -123,12 +123,14 @@ set_target_properties(libshiboken PROPERTIES OUTPUT_NAME "shiboken6${shiboken6_S
install(FILES
autodecref.h
basewrapper.h
+ basewrapper_p.h
bindingmanager.h
gilstate.h
helper.h
sbkarrayconverter.h
sbkconverter.h
sbkenum.h
+ sbkenum_p.h
sbkmodule.h
sbkstring.h
sbkstaticstrings.h
diff --git a/sources/shiboken6/libshiboken/pep384impl.h b/sources/shiboken6/libshiboken/pep384impl.h
index d314dc6c8..3d1a554ae 100644
--- a/sources/shiboken6/libshiboken/pep384impl.h
+++ b/sources/shiboken6/libshiboken/pep384impl.h
@@ -152,7 +152,6 @@ LIBSHIBOKEN_API PyObject *_PepType_Lookup(PyTypeObject *type, PyObject *name);
struct SbkObjectTypePrivate;
struct PySideQFlagsTypePrivate;
-struct _SbkGenericTypePrivate;
#define PepHeapType_SIZE \
(reinterpret_cast<PyTypeObject *>(&PyType_Type)->tp_basicsize)
diff --git a/sources/shiboken6/libshiboken/pep384impl_doc.rst b/sources/shiboken6/libshiboken/pep384impl_doc.rst
index d8ebdbe70..f8e29d321 100644
--- a/sources/shiboken6/libshiboken/pep384impl_doc.rst
+++ b/sources/shiboken6/libshiboken/pep384impl_doc.rst
@@ -284,7 +284,6 @@ dynamically compute the right offsets of the extended type structures:
* ``PepType_SOTP`` for ``SbkObjectTypePrivate``
* ``PepType_SETP`` for ``SbkEnumTypePrivate``
* ``PepType_PFTP`` for ``PySideQFlagsTypePrivate``
-* ``PepType_SGTP`` for ``_SbkGenericTypePrivate``
How these extension structures are used can best be seen by searching
``PepType_{four}`` in the source.
diff --git a/sources/shiboken6/libshiboken/sbkconverter.h b/sources/shiboken6/libshiboken/sbkconverter.h
index 6c7a29300..36c956bd5 100644
--- a/sources/shiboken6/libshiboken/sbkconverter.h
+++ b/sources/shiboken6/libshiboken/sbkconverter.h
@@ -42,6 +42,9 @@
#include "sbkpython.h"
#include "shibokenmacros.h"
+#include "sbkenum.h"
+#include "sbkenum_p.h"
+#include "basewrapper_p.h"
#include <limits>
#include <string>
@@ -397,9 +400,10 @@ template<> inline PyTypeObject *SbkType<std::nullptr_t>() { return Py_TYPE(&_Py_
#define PyObject_Check(X) true
#define SbkChar_Check(X) (SbkNumber_Check(X) || Shiboken::String::checkChar(X))
-struct _SbkGenericTypePrivate {
- SbkConverter **converter;
+struct PySideQFlagsTypePrivate
+{
+ SbkConverter **converterPtr;
+ SbkConverter *converter;
};
-
#endif // SBK_CONVERTER_H
diff --git a/sources/shiboken6/libshiboken/sbkenum.cpp b/sources/shiboken6/libshiboken/sbkenum.cpp
index a3d17ea2e..217b78a2a 100644
--- a/sources/shiboken6/libshiboken/sbkenum.cpp
+++ b/sources/shiboken6/libshiboken/sbkenum.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "sbkenum.h"
+#include "sbkenum_p.h"
#include "sbkstring.h"
#include "sbkstaticstrings.h"
#include "sbkstaticstrings_p.h"
@@ -56,13 +57,6 @@ using enum_func = PyObject *(*)(PyObject *, PyObject *);
extern "C"
{
-struct SbkEnumTypePrivate
-{
- SbkConverter **converterPtr;
- SbkConverter *converter;
- const char *cppName;
-};
-
struct SbkEnumType
{
PyTypeObject type;
@@ -722,13 +716,13 @@ long int getValue(PyObject *enumItem)
void setTypeConverter(PyTypeObject *enumType, SbkConverter *converter)
{
//reinterpret_cast<SbkEnumType *>(enumType)->converter = converter;
- *PepType_SGTP(enumType)->converter = converter;
+ PepType_SETP(enumType)->converter = converter;
}
SbkConverter *getTypeConverter(PyTypeObject *enumType)
{
//return reinterpret_cast<SbkEnumType *>(enumType)->converter;
- return *PepType_SGTP(enumType)->converter;
+ return PepType_SETP(enumType)->converter;
}
} // namespace Enum
diff --git a/sources/shiboken6/libshiboken/sbkenum_p.h b/sources/shiboken6/libshiboken/sbkenum_p.h
new file mode 100644
index 000000000..fdd98d771
--- /dev/null
+++ b/sources/shiboken6/libshiboken/sbkenum_p.h
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SBKENUM_P_H
+#define SBKENUM_P_H
+
+#include "sbkpython.h"
+#include "shibokenmacros.h"
+
+struct SbkEnumTypePrivate
+{
+ SbkConverter **converterPtr;
+ SbkConverter *converter;
+ const char *cppName;
+};
+
+#endif // SKB_PYENUM_P_H
diff --git a/testing/__init__.py b/testing/__init__.py
index c97f32187..001446994 100644
--- a/testing/__init__.py
+++ b/testing/__init__.py
@@ -44,19 +44,20 @@ testing/__init__.py
- define command.main as entry point
"""
+import builtins
import sys
from . import command
main = command.main
# modify print so that it always flushes
-__builtins__["orig_print"] = __builtins__["print"]
+builtins.orig_print = builtins.print
def print_flushed(*args, **kw):
orig_print(*args, **kw)
sys.stdout.flush()
-__builtins__["print"] = print_flushed
+builtins.print = print_flushed
print = print_flushed