shiboken2: update to 5.15.5

This commit is contained in:
yopito 2022-08-22 13:42:32 +02:00 committed by Piraty
parent aa0330c2ab
commit d1986f9ba6
No known key found for this signature in database
GPG key ID: 82F2CC796BD07077
5 changed files with 22 additions and 209 deletions

View file

@ -0,0 +1,18 @@
rework of commit 1422cf4a7f277fb13fd209f24a90d6c02641497d (shiboken6)
--- a/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp
+++ b/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp
@@ -116,8 +116,13 @@
str << " NPY_ARRAY_NOTSWAPPED";
if ((flags & NPY_ARRAY_WRITEABLE) != 0)
str << " NPY_ARRAY_WRITEABLE";
+#if NPY_VERSION >= 0x00000010 // NPY_1_23_API_VERSION
+ if ((flags & NPY_ARRAY_WRITEBACKIFCOPY) != 0)
+ str << " NPY_ARRAY_WRITEBACKIFCOPY";
+#else
if ((flags & NPY_ARRAY_UPDATEIFCOPY) != 0)
str << " NPY_ARRAY_UPDATEIFCOPY";
+#endif
} else {
str << '0';
}

View file

@ -1,5 +1,5 @@
Consistent file naming across architectures for so libs and cmake files:
remove intermediate suffix like ".cpython-36m-x86_64-linux-gnu".
remove python suffix like ".cpython-36m-x86_64-linux-gnu".
Avoid overwriting the "real" cmake file with the generic wrapper's one (same
name in such a case)

View file

@ -1,114 +0,0 @@
The first patch is taken from the issue and resolution documented at
https://bugreports.qt.io/browse/PYSIDE-1436
Note that strings created as part of the `staticStrings()` set used in the
`finalizeStaticStrings()` function are created by `createStaticString()`, which
uses `PyUnicode_InternFromString` to create an owned reference to an interned
Python string **and** calls Py_INCREF to further guard against the strings
disappearing. Thus, in `finalizeStaticStrings()`, we need *two* calls to
Py_DECREF: one to clear the "guard" increment after creation and one to release
ownership from the creation itself.
The second and third patches are adapted from
https://codereview.qt-project.org/c/pyside/pyside-setup/+/348390
The second addresses the disappearance of _Py_Mangle from Python 3.10 by
providing an alternative implementation that was previously reserved for
Py_LIMITED_API.
The fourth patch was adapted from
https://codereview.qt-project.org/c/pyside/pyside-setup/+/365403/4
Together with the third patch,t his addresses changes to the typing module that
caused the pyi binding generator to fail in some cases.
diff -ur a/sources/shiboken2/libshiboken/pep384impl.cpp b/sources/shiboken2/libshiboken/pep384impl.cpp
--- a/sources/shiboken2/libshiboken/pep384impl.cpp 2020-11-11 07:51:30.000000000 -0500
+++ b/sources/shiboken2/libshiboken/pep384impl.cpp 2021-09-26 08:47:00.614184926 -0400
@@ -751,14 +751,14 @@
#endif // IS_PY2
Shiboken::AutoDecRef privateobj(PyObject_GetAttr(
reinterpret_cast<PyObject *>(Py_TYPE(self)), Shiboken::PyMagicName::name()));
-#ifndef Py_LIMITED_API
- return _Py_Mangle(privateobj, name);
-#else
- // For some reason, _Py_Mangle is not in the Limited API. Why?
- size_t plen = PyUnicode_GET_LENGTH(privateobj);
+
+ // PYSIDE-1436: _Py_Mangle is no longer exposed; implement it always.
+ // The rest of this function is our own implementation of _Py_Mangle.
+ // Please compare the original function in compile.c .
+ size_t plen = PyUnicode_GET_LENGTH(privateobj.object());
/* Strip leading underscores from class name */
size_t ipriv = 0;
- while (PyUnicode_READ_CHAR(privateobj, ipriv) == '_')
+ while (PyUnicode_READ_CHAR(privateobj.object(), ipriv) == '_')
ipriv++;
if (ipriv == plen) {
Py_INCREF(name);
@@ -787,7 +787,6 @@
if (amount > big_stack)
free(resbuf);
return result;
-#endif // else Py_LIMITED_API
}
/*****************************************************************************
diff -ur a/sources/shiboken2/libshiboken/sbkstring.cpp b/sources/shiboken2/libshiboken/sbkstring.cpp
--- a/sources/shiboken2/libshiboken/sbkstring.cpp 2020-11-11 07:51:30.000000000 -0500
+++ b/sources/shiboken2/libshiboken/sbkstring.cpp 2021-09-26 08:47:00.614184926 -0400
@@ -247,8 +247,15 @@
{
auto &set = staticStrings();
for (PyObject *ob : set) {
+ // Since Python 3.10, interned strings at deleted at Python exit.
+#if PY_VERSION_HEX >= 0x030a0000
+ Py_DECREF(ob);
+ // createStaticString() calls Py_INCREF()
+ Py_DECREF(ob);
+#else
Py_REFCNT(ob) = 1;
Py_DECREF(ob);
+#endif
}
set.clear();
}
diff -ur a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py 2020-11-11 07:51:30.000000000 -0500
+++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py 2021-09-26 08:47:00.614184926 -0400
@@ -300,6 +300,7 @@
"zero(object)": None,
"zero(str)": "",
"zero(typing.Any)": None,
+ "zero(Any)": None,
})
type_map.update({
diff -ur a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py
--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py 2020-11-11 07:51:30.000000000 -0500
+++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py 2021-09-26 08:48:27.743171587 -0400
@@ -43,10 +43,11 @@
import re
import warnings
import types
+import typing
import keyword
import functools
from shibokensupport.signature.mapping import (type_map, update_mapping,
- namespace, typing, _NotCalled, ResultVariable, ArrayLikeVariable)
+ namespace, _NotCalled, ResultVariable, ArrayLikeVariable)
from shibokensupport.signature.lib.tool import (SimpleNamespace,
build_brace_pattern)
@@ -222,7 +223,7 @@
def to_string(thing):
if isinstance(thing, str):
return thing
- if hasattr(thing, "__name__"):
+ if hasattr(thing, "__name__") and thing.__module__ != "typing":
dot = "." in str(thing)
name = get_name(thing)
return thing.__module__ + "." + name if dot else name

View file

@ -1,91 +0,0 @@
This changeset is about both shiboken2 and python3-pyside2
(that are separated packages)
upstream: yes
From c6184e01e993dcca9798f306fb8e9cb322fdd0dc Mon Sep 17 00:00:00 2001
From: Christian Tismer <tismer@stackless.com>
Date: Thu, 3 Dec 2020 13:38:58 +0100
Subject: [PATCH] fix both qflags_test and the qflags cppgenerator code
There was a years-old qflags test failing on Python 3.
It was blacklisted with the comment
"# Nested exception in Python 3"
This was nonsense: The test was wrong also for Python 2.
It just happened to work, because Python 2 had some weird
errors leaking. The real bug was in missing error handling
in cppgenerator.cpp .
See the main description in the issue.
Change-Id: Ia0f9466640e0eb33f1b8b26178d33f2be0bcb32f
Task-number: PYSIDE-1442
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 288fadb796ec4e11e99e3752d531ada7edf15d75)
---
build_history/blacklist.txt | 3 ---
sources/pyside2/tests/QtCore/qflags_test.py | 12 +++++++-----
.../shiboken2/generator/shiboken2/cppgenerator.cpp | 2 ++
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git build_history/blacklist.txt build_history/blacklist.txt
index 9b63f9784..2a2a5d4c4 100644
--- a/build_history/blacklist.txt
+++ b/build_history/blacklist.txt
@@ -18,9 +18,6 @@
darwin py3
[QtCore::qfileread_test]
darwin
-# Nested exception in Python 3
-[QtCore::qflags_test]
- py3
[QtCore::qobject_connect_notify_test]
linux
darwin
diff --git sources/pyside2/tests/QtCore/qflags_test.py sources/pyside2/tests/QtCore/qflags_test.py
index 08a7c55b1..e1e989c1e 100644
--- a/sources/pyside2/tests/QtCore/qflags_test.py
+++ b/sources/pyside2/tests/QtCore/qflags_test.py
@@ -30,6 +30,7 @@
'''Test cases for QFlags'''
+import operator
import os
import sys
import unittest
@@ -117,12 +118,13 @@ class QFlagsOnQVariant(unittest.TestCase):
class QFlagsWrongType(unittest.TestCase):
def testWrongType(self):
'''Wrong type passed to QFlags binary operators'''
+ for op in operator.or_, operator.and_, operator.xor:
+ for x in '43', 'jabba', QObject, object:
+ self.assertRaises(TypeError, op, Qt.NoItemFlags, x)
+ self.assertRaises(TypeError, op, x, Qt.NoItemFlags)
+ # making sure this actually does not fail all the time
+ self.assertEqual(operator.or_(Qt.NoItemFlags, 43), 43)
- self.assertRaises(TypeError, Qt.NoItemFlags | '43')
- self.assertRaises(TypeError, Qt.NoItemFlags & '43')
- self.assertRaises(TypeError, 'jabba' & Qt.NoItemFlags)
- self.assertRaises(TypeError, 'hut' & Qt.NoItemFlags)
- self.assertRaises(TypeError, Qt.NoItemFlags & QObject())
if __name__ == '__main__':
unittest.main()
diff --git sources/shiboken2/generator/shiboken2/cppgenerator.cpp sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index ff44db955..87ddd73a5 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -5230,6 +5230,8 @@ void CppGenerator::writeFlagsBinaryOperator(QTextStream &s, const AbstractMetaEn
s << INDENT << "cppArg = static_cast<" << flagsEntry->originalName()
<< ">(int(PyInt_AsLong(" << PYTHON_ARG << ")));\n";
s << "#endif\n\n";
+ s << INDENT << "if (PyErr_Occurred())\n" << indent(INDENT)
+ << INDENT << "return nullptr;\n" << outdent(INDENT);
s << INDENT << "cppResult = " << CPP_SELF_VAR << " " << cppOpName << " cppArg;\n";
s << INDENT << "return ";
writeToPythonConversion(s, flagsType, nullptr, QLatin1String("cppResult"));
--
2.29.2

View file

@ -1,7 +1,7 @@
# Template file for 'shiboken2'
pkgname=shiboken2
version=5.15.2
revision=4
version=5.15.5
revision=1
_pkgname="pyside-setup-opensource-src-${version}"
wrksrc="${_pkgname/%5.14.2.1/5.14.2}"
build_wrksrc="sources/shiboken2"
@ -15,7 +15,7 @@ maintainer="yopito <pierre.bourgin@free.fr>"
license="GPL-3.0-or-later"
homepage="https://wiki.qt.io/Qt_for_Python/Shiboken"
distfiles="https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-${version}-src/${_pkgname}.tar.xz"
checksum=b306504b0b8037079a8eab772ee774b9e877a2d84bab2dbefbe4fa6f83941418
checksum=3920a4fb353300260c9bc46ff70f1fb975c5e7efa22e9d51222588928ce19b33
python_version=3
export CLANG_INSTALL_DIR=${XBPS_CROSS_BASE}/usr