aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2021-01-04 19:10:52 +0100
committerChristian Tismer <tismer@stackless.com>2021-01-13 23:08:32 +0100
commitac2a77d7bd84aa01c16916d473b3c77c541b03a8 (patch)
tree6583c2b84533a994fc395ba3d5fb1d4e45bcf722
parent5a90b97f79c3062149bed49ab45b745ef848c749 (diff)
allow to use shiboken.delete() to delete Q*Application
This function should initially not allow deleting Q*Application with a shiboken.delete() function, but unfortunately some competitor can do that, so we will as well. Deletion of qApp needs knowledge about qApp. We add a hook function that calls the pyside function `destroyQCoreApplication`. A special problem was testing interactively. See the error description for the days long journey :) Change-Id: I34862425c2cb2cc80d6cafc22d25a867f96f3e0a Fixes: PYSIDE-1470 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 98aba46414b666c27df3904d2b4313f0a16e05dc)
-rw-r--r--sources/pyside2/libpyside/pyside.cpp4
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp5
-rw-r--r--sources/shiboken2/libshiboken/CMakeLists.txt2
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.cpp116
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.h16
-rw-r--r--sources/shiboken2/libshiboken/basewrapper_p.h3
-rw-r--r--sources/shiboken2/libshiboken/qapp_macro.cpp98
-rw-r--r--sources/shiboken2/libshiboken/qapp_macro.h52
-rw-r--r--sources/shiboken2/libshiboken/sbkstaticstrings.cpp3
-rw-r--r--sources/shiboken2/libshiboken/sbkstaticstrings.h3
-rw-r--r--sources/shiboken2/libshiboken/sbkstaticstrings_p.h1
11 files changed, 104 insertions, 199 deletions
diff --git a/sources/pyside2/libpyside/pyside.cpp b/sources/pyside2/libpyside/pyside.cpp
index 297e5a3b2..5d0859adc 100644
--- a/sources/pyside2/libpyside/pyside.cpp
+++ b/sources/pyside2/libpyside/pyside.cpp
@@ -58,7 +58,6 @@
#include <sbkconverter.h>
#include <sbkstring.h>
#include <sbkstaticstrings.h>
-#include <qapp_macro.h>
#include <QtCore/QByteArray>
#include <QtCore/QCoreApplication>
@@ -304,6 +303,9 @@ void initQApp()
*/
if (!qApp)
Py_DECREF(MakeQAppWrapper(nullptr));
+
+ // PYSIDE-1470: Register a function to destroy an application from shiboken.
+ setDestroyQApplication(destroyQCoreApplication);
}
PyObject *getMetaDataFromQObject(QObject *cppSelf, PyObject *self, PyObject *name)
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 559a286ed..786308023 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -359,7 +359,6 @@ void CppGenerator::generateClass(QTextStream &s, const GeneratorContext &classCo
<< "#include <pyside.h>\n"
<< "#include <pysideqenum.h>\n"
<< "#include <feature_select.h>\n"
- << "#include <qapp_macro.h>\n\n"
<< "QT_WARNING_DISABLE_DEPRECATED\n\n";
}
@@ -4194,15 +4193,14 @@ void CppGenerator::writeClassDefinition(QTextStream &s,
tp_new = QLatin1String("SbkDummyNew /* PYSIDE-595: Prevent replacement "
"of \"0\" with base->tp_new. */");
}
- tp_flags.append(QLatin1String("|Py_TPFLAGS_HAVE_GC"));
}
else if (isQApp) {
tp_new = QLatin1String("SbkQAppTpNew"); // PYSIDE-571: need singleton app
}
else {
tp_new = QLatin1String("SbkObjectTpNew");
- tp_flags.append(QLatin1String("|Py_TPFLAGS_HAVE_GC"));
}
+ tp_flags.append(QLatin1String("|Py_TPFLAGS_HAVE_GC"));
QString tp_richcompare;
if (!metaClass->isNamespace() && metaClass->hasComparisonOperatorOverload())
@@ -5970,7 +5968,6 @@ bool CppGenerator::finishGeneration()
s << "#include <pyside.h>\n";
s << "#include <pysideqenum.h>\n";
s << "#include <feature_select.h>\n";
- s << "#include <qapp_macro.h>\n";
}
s << "#include \"" << getModuleHeaderFileName() << '"' << Qt::endl << Qt::endl;
diff --git a/sources/shiboken2/libshiboken/CMakeLists.txt b/sources/shiboken2/libshiboken/CMakeLists.txt
index a209dc711..45b41fd13 100644
--- a/sources/shiboken2/libshiboken/CMakeLists.txt
+++ b/sources/shiboken2/libshiboken/CMakeLists.txt
@@ -57,7 +57,6 @@ sbkstaticstrings.cpp
bindingmanager.cpp
threadstatesaver.cpp
shibokenbuffer.cpp
-qapp_macro.cpp
pep384impl.cpp
voidptr.cpp
typespec.cpp
@@ -142,7 +141,6 @@ install(FILES
shibokenbuffer.h
sbkpython.h
pep384impl.h
- qapp_macro.h
voidptr.h
typespec.h
bufferprocs_py37.h
diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp
index ac086b354..dca5631bc 100644
--- a/sources/shiboken2/libshiboken/basewrapper.cpp
+++ b/sources/shiboken2/libshiboken/basewrapper.cpp
@@ -56,7 +56,6 @@
#include <algorithm>
#include "threadstatesaver.h"
#include "signature.h"
-#include "qapp_macro.h"
#include "voidptr.h"
#include <iostream>
@@ -96,6 +95,13 @@ static void SbkObjectTypeDealloc(PyObject *pyObj);
static PyObject *SbkObjectTypeTpNew(PyTypeObject *metatype, PyObject *args, PyObject *kwds);
static SelectableFeatureHook SelectFeatureSet = nullptr;
+static DestroyQAppHook DestroyQApplication = nullptr;
+
+// PYSIDE-1470: Provide a hook to kill an Application from Shiboken.
+void setDestroyQApplication(DestroyQAppHook func)
+{
+ DestroyQApplication = func;
+}
static PyObject *Sbk_TypeGet___dict__(PyTypeObject *type, void *context); // forward
@@ -427,9 +433,7 @@ static void SbkDeallocWrapperCommon(PyObject *pyObj, bool canDelete)
// be invoked and it trying to delete this object while it is still in
// progress from the first time around, resulting in a double delete and a
// crash.
- // PYSIDE-571: Some objects do not use GC, so check this!
- if (PyObject_IS_GC(pyObj))
- PyObject_GC_UnTrack(pyObj);
+ PyObject_GC_UnTrack(pyObj);
// Check that Python is still initialized as sometimes this is called by a static destructor
// after Python interpeter is shutdown.
@@ -541,6 +545,47 @@ void SbkObjectTypeDealloc(PyObject *pyObj)
}
}
+////////////////////////////////////////////////////////////////////////////
+//
+// Support for the qApp macro.
+//
+// qApp is a macro in Qt5. In Python, we simulate that a little by a
+// variable that monitors Q*Application.instance().
+// This variable is also able to destroy the app by qApp.shutdown().
+//
+
+PyObject *MakeQAppWrapper(PyTypeObject *type)
+{
+ static PyObject *qApp_last = nullptr;
+
+ // protecting from multiple application instances
+ if (!(type == nullptr || qApp_last == Py_None)) {
+ const char *res_name = PepType_GetNameStr(Py_TYPE(qApp_last));
+ const char *type_name = PepType_GetNameStr(type);
+ PyErr_Format(PyExc_RuntimeError, "Please destroy the %s singleton before"
+ " creating a new %s instance.", res_name, type_name);
+ return nullptr;
+ }
+
+ // monitoring the last application state
+ PyObject *qApp_curr = type != nullptr ? PyObject_GC_New(PyObject, type) : Py_None;
+ static PyObject *builtins = PyEval_GetBuiltins();
+ if (PyDict_SetItem(builtins, Shiboken::PyName::qApp(), qApp_curr) < 0)
+ return nullptr;
+ qApp_last = qApp_curr;
+ // Note: This Py_INCREF would normally be wrong because the qApp
+ // object already has a reference from PyObject_GC_New. But this is
+ // exactly the needed reference that keeps qApp alive from alone!
+ Py_INCREF(qApp_curr);
+ // PYSIDE-1470: As a side effect, the interactive "_" variable tends to
+ // create reference cycles. It was found when using gc.collect(). But using
+ // PyGC_collect() inside the C code had no effect in the interactive shell.
+ // The cycle exists only in the eval loop of the interpreter!
+ if (PyDict_GetItem(builtins, Shiboken::PyName::underscore()))
+ PyDict_SetItem(builtins, Shiboken::PyName::underscore(), Py_None);
+ return qApp_curr;
+}
+
//////////////////////////////////////////////////////////////////////////////
//
// PYSIDE-1019: Support switchable extensions
@@ -555,9 +600,11 @@ void SbkObjectTypeDealloc(PyObject *pyObj)
// SbkObject_GenericSetAttr PyObject_GenericSetAttr
//
-void initSelectableFeature(SelectableFeatureHook func)
+SelectableFeatureHook initSelectableFeature(SelectableFeatureHook func)
{
+ auto ret = SelectFeatureSet;
SelectFeatureSet = func;
+ return ret;
}
static PyObject *mangled_type_getattro(PyTypeObject *type, PyObject *name)
@@ -579,7 +626,7 @@ static PyObject *Sbk_TypeGet___dict__(PyTypeObject *type, void *context)
* This is the override for getting a dict.
*/
auto dict = type->tp_dict;
- if (dict == NULL)
+ if (dict == nullptr)
Py_RETURN_NONE;
if (SelectFeatureSet != nullptr)
dict = SelectFeatureSet(type);
@@ -723,10 +770,13 @@ static PyObject *SbkObjectTypeTpNew(PyTypeObject *metatype, PyObject *args, PyOb
sotp->d_func = nullptr;
sotp->is_user_type = 1;
+ // PYSIDE-1463: Prevent feature switching while in the creation process
+ auto saveFeature = initSelectableFeature(nullptr);
for (SbkObjectType *base : bases) {
if (PepType_SOTP(base)->subtype_init)
PepType_SOTP(base)->subtype_init(newType, args, kwds);
}
+ initSelectableFeature(saveFeature);
return reinterpret_cast<PyObject *>(newType);
}
@@ -749,42 +799,25 @@ static PyObject *_setupNew(SbkObject *self, PyTypeObject *subtype)
self->ob_dict = nullptr;
self->weakreflist = nullptr;
self->d = d;
+ PyObject_GC_Track(reinterpret_cast<PyObject *>(self));
return reinterpret_cast<PyObject *>(self);
}
PyObject *SbkObjectTpNew(PyTypeObject *subtype, PyObject *, PyObject *)
{
SbkObject *self = PyObject_GC_New(SbkObject, subtype);
- PyObject *res = _setupNew(self, subtype);
- PyObject_GC_Track(reinterpret_cast<PyObject *>(self));
- return res;
+ return _setupNew(self, subtype);
}
PyObject *SbkQAppTpNew(PyTypeObject *subtype, PyObject *, PyObject *)
{
- // PYSIDE-571:
- // For qApp, we need to create a singleton Python object.
- // We cannot track this with the GC, because it is a static variable!
-
- // Python 2 has a weird handling of flags in derived classes that Python 3
- // does not have. Observed with bug_307.py.
- // But it could theoretically also happen with Python3.
- // Therefore we enforce that there is no GC flag, ever!
-
- // PYSIDE-560:
- // We avoid to use this in Python 3, because we have a hard time to get
- // write access to these flags
-
- // PYSIDE-1447:
- // Since Python 3.8, we have the same weird flags handling in Python 3.8
- // as well. The singleton Python is no longer needed and we could remove
- // the whole special handling, maybe in another checkin.
- if (PyType_HasFeature(subtype, Py_TPFLAGS_HAVE_GC)) {
- subtype->tp_flags &= ~Py_TPFLAGS_HAVE_GC;
- subtype->tp_free = PyObject_Del;
- }
auto self = reinterpret_cast<SbkObject *>(MakeQAppWrapper(subtype));
- return self == nullptr ? nullptr : _setupNew(self, subtype);
+ if (self == nullptr)
+ return nullptr;
+ auto ret = _setupNew(self, subtype);
+ auto priv = self->d;
+ priv->isQAppSingleton = 1;
+ return ret;
}
PyObject *SbkDummyNew(PyTypeObject *type, PyObject *, PyObject *)
@@ -862,7 +895,7 @@ PyObject *FallbackRichCompare(PyObject *self, PyObject *other, int op)
opstrings[op],
self->ob_type->tp_name,
other->ob_type->tp_name);
- return NULL;
+ return nullptr;
}
Py_INCREF(res);
return res;
@@ -1274,6 +1307,12 @@ bool wasCreatedByPython(SbkObject *pyObj)
void callCppDestructors(SbkObject *pyObj)
{
+ auto priv = pyObj->d;
+ if (priv->isQAppSingleton && DestroyQApplication) {
+ // PYSIDE-1470: Allow to destroy the application from Shiboken.
+ DestroyQApplication();
+ return;
+ }
PyTypeObject *type = Py_TYPE(pyObj);
SbkObjectTypePrivate *sotp = PepType_SOTP(type);
if (sotp->is_multicpp) {
@@ -1286,18 +1325,19 @@ void callCppDestructors(SbkObject *pyObj)
sotp->cpp_dtor(pyObj->d->cptr[0]);
}
+ if (priv->validCppObject && priv->containsCppWrapper) {
+ BindingManager::instance().releaseWrapper(pyObj);
+ }
+
/* invalidate needs to be called before deleting pointer array because
it needs to delete entries for them from the BindingManager hash table;
also release wrapper explicitly if object contains C++ wrapper because
invalidate doesn't */
invalidate(pyObj);
- if (pyObj->d->validCppObject && pyObj->d->containsCppWrapper) {
- BindingManager::instance().releaseWrapper(pyObj);
- }
- delete[] pyObj->d->cptr;
- pyObj->d->cptr = nullptr;
- pyObj->d->validCppObject = false;
+ delete[] priv->cptr;
+ priv->cptr = nullptr;
+ priv->validCppObject = false;
}
bool hasOwnership(SbkObject *pyObj)
diff --git a/sources/shiboken2/libshiboken/basewrapper.h b/sources/shiboken2/libshiboken/basewrapper.h
index 204c4c1c3..2f0c22e9f 100644
--- a/sources/shiboken2/libshiboken/basewrapper.h
+++ b/sources/shiboken2/libshiboken/basewrapper.h
@@ -93,9 +93,10 @@ typedef void (*ObjectDestructor)(void *);
typedef void (*SubTypeInitHook)(SbkObjectType *, PyObject *, PyObject *);
-// PYSIDE-1019: Set the function to select the current feature.
+/// PYSIDE-1019: Set the function to select the current feature.
+/// Return value is the previous content.
typedef PyObject *(*SelectableFeatureHook)(PyTypeObject *);
-LIBSHIBOKEN_API void initSelectableFeature(SelectableFeatureHook func);
+LIBSHIBOKEN_API SelectableFeatureHook initSelectableFeature(SelectableFeatureHook func);
// PYSIDE-1019: Get access to PySide reserved bits.
LIBSHIBOKEN_API int SbkObjectType_GetReserved(PyTypeObject *type);
@@ -105,6 +106,9 @@ LIBSHIBOKEN_API void SbkObjectType_SetReserved(PyTypeObject *type, int value);
LIBSHIBOKEN_API const char **SbkObjectType_GetPropertyStrings(PyTypeObject *type);
LIBSHIBOKEN_API void SbkObjectType_SetPropertyStrings(PyTypeObject *type, const char **strings);
+/// PYSIDE-1470: Set the function to kill a Q*Application.
+typedef void(*DestroyQAppHook)();
+LIBSHIBOKEN_API void setDestroyQApplication(DestroyQAppHook func);
extern LIBSHIBOKEN_API PyTypeObject *SbkObjectType_TypeF(void);
extern LIBSHIBOKEN_API SbkObjectType *SbkObject_TypeF(void);
@@ -118,8 +122,12 @@ struct LIBSHIBOKEN_API SbkObjectType
};
LIBSHIBOKEN_API PyObject *SbkObjectTpNew(PyTypeObject *subtype, PyObject *, PyObject *);
-// the special case of a switchable singleton
-LIBSHIBOKEN_API PyObject *SbkQAppTpNew(PyTypeObject *subtype, PyObject *args, PyObject *kwds);
+
+/// The special case of a switchable singleton Q*Application.
+LIBSHIBOKEN_API PyObject *SbkQAppTpNew(PyTypeObject *subtype, PyObject *, PyObject *);
+
+/// Create a new Q*Application wrapper and monitor it.
+LIBSHIBOKEN_API PyObject *MakeQAppWrapper(PyTypeObject *type);
/**
* PYSIDE-832: Use object_dealloc instead of nullptr.
diff --git a/sources/shiboken2/libshiboken/basewrapper_p.h b/sources/shiboken2/libshiboken/basewrapper_p.h
index 64f7941b7..60fba13c5 100644
--- a/sources/shiboken2/libshiboken/basewrapper_p.h
+++ b/sources/shiboken2/libshiboken/basewrapper_p.h
@@ -97,6 +97,9 @@ struct SbkObjectPrivate
unsigned int validCppObject : 1;
/// Marked as true when the object constructor was called
unsigned int cppObjectCreated : 1;
+ /// PYSIDE-1470: Marked as true if this is the Q*Application singleton.
+ /// This bit allows app deletion from shiboken?.delete() .
+ unsigned int isQAppSingleton : 1;
/// Information about the object parents and children, may be null.
Shiboken::ParentInfo *parentInfo;
/// Manage reference count of objects that are referred to but not owned from.
diff --git a/sources/shiboken2/libshiboken/qapp_macro.cpp b/sources/shiboken2/libshiboken/qapp_macro.cpp
deleted file mode 100644
index 03a8d0496..000000000
--- a/sources/shiboken2/libshiboken/qapp_macro.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 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$
-**
-****************************************************************************/
-
-#include "basewrapper.h"
-#include "autodecref.h"
-
-extern "C"
-{
-
-#include "qapp_macro.h"
-
-////////////////////////////////////////////////////////////////////////////
-//
-// Support for the qApp macro.
-//
-// qApp is a macro in Qt5. In Python, we simulate that a little by a
-// variable that monitors Q*Application.instance().
-// This variable is also able to destroy the app by qApp.shutdown().
-//
-
-static PyObject *qApp_name = nullptr;
-static PyObject *qApp_last = nullptr;
-
-static PyObject *monitor_qApp_var(PyObject *qApp_curr)
-{
- static bool init_done;
- static PyObject *builtins = PyEval_GetBuiltins();
-
- if (!init_done) {
- qApp_name = Py_BuildValue("s", "qApp");
- if (qApp_name == nullptr)
- return nullptr;
- // This is a borrowed reference
- Py_INCREF(builtins);
- init_done = true;
- }
-
- if (PyDict_SetItem(builtins, qApp_name, qApp_curr) < 0)
- return nullptr;
- qApp_last = qApp_curr;
- Py_INCREF(qApp_curr);
- return qApp_curr;
-}
-
-PyObject *MakeQAppWrapper(PyTypeObject *type)
-{
- if (type == nullptr)
- type = Py_TYPE(Py_None);
- if (!(type == Py_TYPE(Py_None) || Py_TYPE(qApp_last) == Py_TYPE(Py_None))) {
- const char *res_name = PepType_GetNameStr(Py_TYPE(qApp_last));
- const char *type_name = PepType_GetNameStr(type);
- PyErr_Format(PyExc_RuntimeError, "Please destroy the %s singleton before"
- " creating a new %s instance.", res_name, type_name);
- return nullptr;
- }
- PyObject *self = type != Py_TYPE(Py_None) ? PyObject_New(PyObject, type) : Py_None;
- return monitor_qApp_var(self);
-}
-
-} //extern "C"
-
-// end of module
diff --git a/sources/shiboken2/libshiboken/qapp_macro.h b/sources/shiboken2/libshiboken/qapp_macro.h
deleted file mode 100644
index 9abd17c17..000000000
--- a/sources/shiboken2/libshiboken/qapp_macro.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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 QAPP_MACRO_H
-#define QAPP_MACRO_H
-
-#include "sbkpython.h"
-
-extern "C"
-{
-
-LIBSHIBOKEN_API PyObject *MakeQAppWrapper(PyTypeObject *type);
-
-} // extern "C"
-
-#endif // QAPP_MACRO_H
diff --git a/sources/shiboken2/libshiboken/sbkstaticstrings.cpp b/sources/shiboken2/libshiboken/sbkstaticstrings.cpp
index 2c1a9b891..58d32f217 100644
--- a/sources/shiboken2/libshiboken/sbkstaticstrings.cpp
+++ b/sources/shiboken2/libshiboken/sbkstaticstrings.cpp
@@ -58,7 +58,10 @@ STATIC_STRING_IMPL(fset, "fset")
STATIC_STRING_IMPL(loads, "loads")
STATIC_STRING_IMPL(multi, "multi")
STATIC_STRING_IMPL(name, "name")
+STATIC_STRING_IMPL(qApp, "qApp")
STATIC_STRING_IMPL(result, "result")
+STATIC_STRING_IMPL(select_id, "select_id")
+STATIC_STRING_IMPL(underscore, "_")
STATIC_STRING_IMPL(value, "value")
STATIC_STRING_IMPL(values, "values")
diff --git a/sources/shiboken2/libshiboken/sbkstaticstrings.h b/sources/shiboken2/libshiboken/sbkstaticstrings.h
index 0dd533e32..4aaef814f 100644
--- a/sources/shiboken2/libshiboken/sbkstaticstrings.h
+++ b/sources/shiboken2/libshiboken/sbkstaticstrings.h
@@ -58,6 +58,8 @@ LIBSHIBOKEN_API PyObject *loads();
LIBSHIBOKEN_API PyObject *multi();
LIBSHIBOKEN_API PyObject *name();
LIBSHIBOKEN_API PyObject *result();
+LIBSHIBOKEN_API PyObject *select_id();
+LIBSHIBOKEN_API PyObject *underscore();
LIBSHIBOKEN_API PyObject *value();
LIBSHIBOKEN_API PyObject *values();
} // namespace PyName
@@ -69,6 +71,7 @@ LIBSHIBOKEN_API PyObject *dict();
LIBSHIBOKEN_API PyObject *doc();
LIBSHIBOKEN_API PyObject *ecf();
LIBSHIBOKEN_API PyObject *file();
+LIBSHIBOKEN_API PyObject *func();
LIBSHIBOKEN_API PyObject *get();
LIBSHIBOKEN_API PyObject *members();
LIBSHIBOKEN_API PyObject *module();
diff --git a/sources/shiboken2/libshiboken/sbkstaticstrings_p.h b/sources/shiboken2/libshiboken/sbkstaticstrings_p.h
index c33fa0299..419eeeb10 100644
--- a/sources/shiboken2/libshiboken/sbkstaticstrings_p.h
+++ b/sources/shiboken2/libshiboken/sbkstaticstrings_p.h
@@ -51,6 +51,7 @@ PyObject *marshal();
PyObject *method();
PyObject *mro();
PyObject *overload();
+PyObject *qApp();
PyObject *staticmethod();
} // namespace PyName
namespace PyMagicName