aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-06-27 10:39:03 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-06-27 10:39:14 +0200
commiteb5c77caa313edd85b9ec61c537fdf35539b0c9f (patch)
treefad747b9f3c47a3d79c8dd78f9e7d5630e23796e
parent6cc61508acd7b65477e006475f64dc3406af668f (diff)
parent8bf3f03ba1ce0bcdb1b4a3f2edd7ffd672066e1c (diff)
Merge remote-tracking branch 'origin/5.15' into dev
-rw-r--r--coin/instructions/execute_test_instructions.yaml2
-rw-r--r--coin_build_instructions.py4
-rw-r--r--coin_test_instructions.py4
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml18
-rw-r--r--sources/pyside2/PySide2/glue/qtcore.cpp50
-rw-r--r--sources/pyside2/libpyside/pyside.h2
-rw-r--r--sources/pyside2/tests/QtCore/qobject_parent_test.py7
-rw-r--r--sources/shiboken2/libshiboken/gilstate.cpp7
-rw-r--r--sources/shiboken2/libshiboken/gilstate.h1
-rw-r--r--sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py24
10 files changed, 89 insertions, 30 deletions
diff --git a/coin/instructions/execute_test_instructions.yaml b/coin/instructions/execute_test_instructions.yaml
index 87abb476c..a00f5676e 100644
--- a/coin/instructions/execute_test_instructions.yaml
+++ b/coin/instructions/execute_test_instructions.yaml
@@ -30,7 +30,7 @@ instructions:
- type: ExecuteCommand
command: "c:\\users\\qt\\MSVC.bat python -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=\\Users\\qt\\work\\install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}}"
maxTimeInSeconds: 14400
- maxTimeBetweenOutput: 300
+ maxTimeBetweenOutput: 500
enable_if:
condition: property
property: host.os
diff --git a/coin_build_instructions.py b/coin_build_instructions.py
index bfb10410c..f3f8d2016 100644
--- a/coin_build_instructions.py
+++ b/coin_build_instructions.py
@@ -47,6 +47,8 @@ from build_scripts.utils import get_ci_qmake_path
import os
import datetime
import calendar
+import site
+import sys
# Values must match COIN thrift
CI_HOST_OS = option_value("os")
@@ -110,7 +112,7 @@ def call_setup(python_ver, phase):
if phase in ["BUILD"]:
rmtree(_env, True)
# Pinning the virtualenv before creating one
- run_instruction(["pip", "install", "--user", "virtualenv==20.0.20"], "Failed to pin virtualenv")
+ run_instruction(["pip", "install", "--user", "virtualenv==20.0.25"], "Failed to pin virtualenv")
run_instruction(["virtualenv", "-p", _pExe, _env], "Failed to create virtualenv")
# When the 'python_ver' variable is empty, we are using Python 2
# Pip is always upgraded when CI template is provisioned, upgrading it in later phase may cause perm issue
diff --git a/coin_test_instructions.py b/coin_test_instructions.py
index c3752cb9f..79a788038 100644
--- a/coin_test_instructions.py
+++ b/coin_test_instructions.py
@@ -44,6 +44,8 @@ from build_scripts.utils import run_instruction
from build_scripts.utils import rmtree
from build_scripts.utils import get_ci_qmake_path
import os
+import site
+import sys
# Values must match COIN thrift
CI_HOST_OS = option_value("os")
@@ -65,7 +67,7 @@ def call_testrunner(python_ver, buildnro):
_pExe, _env, env_pip, env_python = get_qtci_virtualEnv(python_ver, CI_HOST_OS, CI_HOST_ARCH, CI_TARGET_ARCH)
rmtree(_env, True)
# Pinning the virtualenv before creating one
- run_instruction(["pip", "install", "--user", "virtualenv==20.0.20"], "Failed to pin virtualenv")
+ run_instruction(["pip", "install", "--user", "virtualenv==20.0.25"], "Failed to pin virtualenv")
run_instruction(["virtualenv", "-p", _pExe, _env], "Failed to create virtualenv")
# When the 'python_ver' variable is empty, we are using Python 2
# Pip is always upgraded when CI template is provisioned, upgrading it in later phase may cause perm issue
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index 829e38551..5d8a1c9c7 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -1477,9 +1477,15 @@
<enum-type name="IteratorFlag" flags="IteratorFlags"/>
</object-type>
<object-type name="QThread">
+ <inject-code file="../glue/qtcore.cpp" class="native" position="beginning" snippet="qthread_pthread_cleanup"/>
<enum-type name="Priority"/>
<modify-function signature="currentThreadId()" remove="all"/>
- <modify-function signature="run()" allow-thread="yes"/>
+ <modify-function signature="run()" allow-thread="yes">
+ <inject-code file="../glue/qtcore.cpp" class="native" position="beginning"
+ snippet="qthread_pthread_cleanup_install"/>
+ <inject-code file="../glue/qtcore.cpp" class="native" position="end"
+ snippet="qthread_pthread_cleanup_uninstall"/>
+ </modify-function>
<modify-function signature="exec()" rename="exec_" allow-thread="yes"/>
<modify-function signature="msleep(unsigned long)" allow-thread="yes"/>
<modify-function signature="sleep(unsigned long)" allow-thread="yes"/>
@@ -1717,7 +1723,7 @@
<inject-documentation format="target" mode="append">
Like the method *findChild*, the first parameter should be the child's type.
</inject-documentation>
- <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-findchildren-1"/>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-findchildren"/>
<modify-argument index="return">
<parent index="this" action="add"/>
</modify-argument>
@@ -1726,7 +1732,13 @@
</modify-argument>
</add-function>
<add-function signature="findChildren(PyTypeObject*,const QRegExp&amp;)" return-type="PySequence*" >
- <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-findchildren-2"/>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-findchildren"/>
+ <modify-argument index="return">
+ <parent index="this" action="add"/>
+ </modify-argument>
+ </add-function>
+ <add-function signature="findChildren(PyTypeObject*,const QRegularExpression&amp;)" return-type="PySequence*" >
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-findchildren"/>
<modify-argument index="return">
<parent index="this" action="add"/>
</modify-argument>
diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp
index 8bd2baac1..d76f2980e 100644
--- a/sources/pyside2/PySide2/glue/qtcore.cpp
+++ b/sources/pyside2/PySide2/glue/qtcore.cpp
@@ -647,7 +647,7 @@ if (%PYARG_0 == Py_None)
// @snippet qline-hash
namespace PySide {
- template<> inline uint hash(const QLine &v) {
+ template<> inline Py_ssize_t hash(const QLine &v) {
return qHash(qMakePair(qMakePair(v.x1(), v.y1()), qMakePair(v.x2(), v.y2())));
}
};
@@ -715,7 +715,7 @@ if (!PyDateTimeAPI) PySideDateTime_IMPORT;
// @snippet qpoint
namespace PySide {
- template<> inline uint hash(const QPoint &v) {
+ template<> inline Py_ssize_t hash(const QPoint &v) {
return qHash(qMakePair(v.x(), v.y()));
}
};
@@ -723,7 +723,7 @@ namespace PySide {
// @snippet qrect
namespace PySide {
- template<> inline uint hash(const QRect &v) {
+ template<> inline Py_ssize_t hash(const QRect &v) {
return qHash(qMakePair(qMakePair(v.x(), v.y()), qMakePair(v.width(), v.height())));
}
};
@@ -731,7 +731,7 @@ namespace PySide {
// @snippet qsize
namespace PySide {
- template<> inline uint hash(const QSize &v) {
+ template<> inline Py_ssize_t hash(const QSize &v) {
return qHash(qMakePair(v.width(), v.height()));
}
};
@@ -806,6 +806,11 @@ static inline bool _findChildrenComparator(const QObject *&child, const QRegExp
return name.indexIn(child->objectName()) != -1;
}
+static inline bool _findChildrenComparator(const QObject *&child, const QRegularExpression &name)
+{
+ return name.match(child->objectName()).hasMatch();
+}
+
static inline bool _findChildrenComparator(const QObject *&child, const QString &name)
{
return name.isNull() || name == child->objectName();
@@ -828,15 +833,10 @@ QObject *child = _findChildHelper(%CPPSELF, %2, reinterpret_cast<PyTypeObject *>
%PYARG_0 = %CONVERTTOPYTHON[QObject *](child);
// @snippet qobject-findchild-2
-// @snippet qobject-findchildren-1
-%PYARG_0 = PyList_New(0);
-_findChildrenHelper(%CPPSELF, %2, reinterpret_cast<PyTypeObject *>(%PYARG_1), %PYARG_0);
-// @snippet qobject-findchildren-1
-
-// @snippet qobject-findchildren-2
+// @snippet qobject-findchildren
%PYARG_0 = PyList_New(0);
_findChildrenHelper(%CPPSELF, %2, reinterpret_cast<PyTypeObject *>(%PYARG_1), %PYARG_0);
-// @snippet qobject-findchildren-2
+// @snippet qobject-findchildren
// @snippet qobject-tr
QString result;
@@ -1984,3 +1984,31 @@ PyTuple_SET_ITEM(%out, 0, %CONVERTTOPYTHON[%INTYPE_0](%in.first));
PyTuple_SET_ITEM(%out, 1, %CONVERTTOPYTHON[%INTYPE_1](%in.second));
return %out;
// @snippet return-qpair
+
+// @snippet qthread_pthread_cleanup
+#ifdef Q_OS_UNIX
+# include <stdio.h>
+# include <pthread.h>
+static void qthread_pthread_cleanup(void *arg)
+{
+ // PYSIDE 1282: When terminating a thread using QThread::terminate()
+ // (pthread_cancel()), QThread::run() is aborted and the lock is released,
+ // but ~GilState() is still executed for some reason. Prevent it from
+ // releasing.
+ auto gil = reinterpret_cast<Shiboken::GilState *>(arg);
+ gil->abandon();
+}
+#endif // Q_OS_UNIX
+// @snippet qthread_pthread_cleanup
+
+// @snippet qthread_pthread_cleanup_install
+#ifdef Q_OS_UNIX
+pthread_cleanup_push(qthread_pthread_cleanup, &gil);
+#endif
+// @snippet qthread_pthread_cleanup_install
+
+// @snippet qthread_pthread_cleanup_uninstall
+#ifdef Q_OS_UNIX
+pthread_cleanup_pop(0);
+#endif
+// @snippet qthread_pthread_cleanup_uninstall
diff --git a/sources/pyside2/libpyside/pyside.h b/sources/pyside2/libpyside/pyside.h
index 95abaeeb1..c1a298cc8 100644
--- a/sources/pyside2/libpyside/pyside.h
+++ b/sources/pyside2/libpyside/pyside.h
@@ -62,7 +62,7 @@ PYSIDE_API void init(PyObject *module);
* Hash function used to enable hash on objects not supported on native Qt library which has toString function.
*/
template<class T>
-inline uint hash(const T& value)
+inline Py_ssize_t hash(const T& value)
{
return qHash(value.toString());
}
diff --git a/sources/pyside2/tests/QtCore/qobject_parent_test.py b/sources/pyside2/tests/QtCore/qobject_parent_test.py
index 7e98100a1..0a02fbc26 100644
--- a/sources/pyside2/tests/QtCore/qobject_parent_test.py
+++ b/sources/pyside2/tests/QtCore/qobject_parent_test.py
@@ -144,10 +144,13 @@ class ParentCase(unittest.TestCase):
res = parent.findChildren(QTimer)
self.assertEqual(len(res), 20)
- # test findChildre with a regex
- res = parent.findChildren(QObject, QRegExp("^fo+"))
+ # test findChildren with a QRegularExpression
+ res = parent.findChildren(QObject, QRegularExpression("^fo+"))
self.assertEqual(res, test_children)
+ # test findChildren with a QRegExp (deprecated)
+ res = parent.findChildren(QObject, QRegExp("^fo+"))
+ self.assertEqual(res, test_children)
def testParentEquality(self):
#QObject.parent() == parent
diff --git a/sources/shiboken2/libshiboken/gilstate.cpp b/sources/shiboken2/libshiboken/gilstate.cpp
index a59c6f01e..76a4d0e61 100644
--- a/sources/shiboken2/libshiboken/gilstate.cpp
+++ b/sources/shiboken2/libshiboken/gilstate.cpp
@@ -63,5 +63,12 @@ void GilState::release()
}
}
+// Abandon the lock: Only for special situations, like termination of a
+// POSIX thread (PYSIDE 1282).
+void GilState::abandon()
+{
+ m_locked = false;
+}
+
} // namespace Shiboken
diff --git a/sources/shiboken2/libshiboken/gilstate.h b/sources/shiboken2/libshiboken/gilstate.h
index d22f688ba..fbf39ead0 100644
--- a/sources/shiboken2/libshiboken/gilstate.h
+++ b/sources/shiboken2/libshiboken/gilstate.h
@@ -57,6 +57,7 @@ public:
GilState();
~GilState();
void release();
+ void abandon();
private:
PyGILState_STATE m_gstate;
bool m_locked = false;
diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py
index 2053c3e9d..bfc5b3a30 100644
--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py
+++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py
@@ -111,17 +111,21 @@ def _parse_line(line):
arglist = _parse_arglist(argstr)
args = []
for arg in arglist:
- name, ann = arg.split(":")
- if name in keyword.kwlist:
- if LIST_KEYWORDS:
- print("KEYWORD", ret)
- name = name + "_"
- if "=" in ann:
- ann, default = ann.split("=", 1)
- tup = name, ann, default
+ tokens = arg.split(":")
+ if len(tokens) < 2:
+ warnings.warn('Invalid argument "{}" in "{}".'.format(arg, line))
else:
- tup = name, ann
- args.append(tup)
+ name, ann = tokens
+ if name in keyword.kwlist:
+ if LIST_KEYWORDS:
+ print("KEYWORD", ret)
+ name = name + "_"
+ if "=" in ann:
+ ann, default = ann.split("=", 1)
+ tup = name, ann, default
+ else:
+ tup = name, ann
+ args.append(tup)
ret.arglist = args
multi = ret.multi
if multi is not None: