[neon/qt/pyside2/Neon/release] /: New upstream version 5.15.13

Dmitry Shachnev null at kde.org
Thu Jul 25 03:06:04 BST 2024


Git commit 6c86c76b203145985a51f61e8aed416032a4d342 by Dmitry Shachnev.
Committed on 09/03/2024 at 10:31.
Pushed by carlosdem into branch 'Neon/release'.

New upstream version 5.15.13

M  +1    -1    coin/dependencies.yaml
A  +25   -0    dist/changes-5.15.13
A  +2    -0    requirements-doc.txt
M  +0    -1    requirements.txt
M  +2    -0    sources/pyside2/PySide2/QtSql/typesystem_sql.xml
M  +2    -2    sources/pyside2/PySide2/glue/qtcore.cpp
M  +28   -0    sources/pyside2/PySide2/support/deprecated.py
M  +1    -1    sources/pyside2/pyside_version.py
M  +2    -1    sources/shiboken2/libshiboken/bindingmanager.cpp
M  +22   -0    sources/shiboken2/libshiboken/helper.cpp
M  +2    -0    sources/shiboken2/libshiboken/helper.h
M  +41   -5    sources/shiboken2/libshiboken/pep384_issue33738.cpp
M  +1    -2    sources/shiboken2/libshiboken/pep384impl.cpp
M  +13   -11   sources/shiboken2/libshiboken/pep384impl.h
M  +1    -1    sources/shiboken2/libshiboken/sbkconverter.cpp
M  +1    -1    sources/shiboken2/shiboken_version.py

https://invent.kde.org/neon/qt/pyside2/-/commit/6c86c76b203145985a51f61e8aed416032a4d342

diff --git a/coin/dependencies.yaml b/coin/dependencies.yaml
index 7e0fa64e..ba070d4b 100644
--- a/coin/dependencies.yaml
+++ b/coin/dependencies.yaml
@@ -1,6 +1,6 @@
 product_dependency:
   ../../qt/tqtc-qt5.git:
-    ref: "6f699275d508af0c5d61c91914ca1e45fec6b7ef"
+    ref: "6949d6a6915445ea30cd36fc64d843a8fb53bafe"
 dependency_source: supermodule
 dependencies: [
       "../../qt/qt3d",
diff --git a/dist/changes-5.15.13 b/dist/changes-5.15.13
new file mode 100644
index 00000000..37c34664
--- /dev/null
+++ b/dist/changes-5.15.13
@@ -0,0 +1,25 @@
+Qt for Python 5.15.13 is a bug-fix release.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qtforpython/
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+*                                  PySide2                                 *
+****************************************************************************
+
+ - A requirements file for documentation builds (requirements-doc.txt) has
+   been added.
+ - [PYSIDE-1931] A hang in QSqlQueryModel.setQuery() (PostGres with SSH
+   tunnel) was fixed.
+ - [PYSIDE-2101] Python 3.10 and up have an incompatibility
+   to the __signature__ attribute. It is fixed by patching rlcompleter.
diff --git a/requirements-doc.txt b/requirements-doc.txt
new file mode 100644
index 00000000..88736391
--- /dev/null
+++ b/requirements-doc.txt
@@ -0,0 +1,2 @@
+sphinx==5.3
+graphviz
diff --git a/requirements.txt b/requirements.txt
index c4446454..b73d5088 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,7 +5,6 @@ numpy==1.16.6; python_version < '3'
 setuptools==44.0.0; python_version < '3'
 setuptools; python_version >= '3'
 packaging
-sphinx
 six
 wheel>=0.35
 PyOpenGL
diff --git a/sources/pyside2/PySide2/QtSql/typesystem_sql.xml b/sources/pyside2/PySide2/QtSql/typesystem_sql.xml
index 408b5cdc..43d3ec32 100644
--- a/sources/pyside2/PySide2/QtSql/typesystem_sql.xml
+++ b/sources/pyside2/PySide2/QtSql/typesystem_sql.xml
@@ -148,6 +148,8 @@
         <include file-name="QStringList" location="global"/>
         <include file-name="QSize" location="global"/>
     </extra-includes>
+    <modify-function signature="setQuery(QSqlQuery)" allow-thread="yes"/>
+    <modify-function signature="setQuery(QString,QSqlDatabase)" allow-thread="yes"/>
   </object-type>
   <object-type name="QSqlRelationalTableModel">
     <enum-type name="JoinMode"/>
diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp
index 8a9aae8f..0fb55372 100644
--- a/sources/pyside2/PySide2/glue/qtcore.cpp
+++ b/sources/pyside2/PySide2/glue/qtcore.cpp
@@ -918,7 +918,7 @@ if (ret > 0 && ((strcmp(%1, SIGNAL(destroyed())) == 0) || (strcmp(%1, SIGNAL(des
 // @snippet qregexp-replace
 
 // @snippet qbytearray-mgetitem
-if (PyIndex_Check(_key)) {
+if (PepIndex_Check(_key)) {
     Py_ssize_t _i;
     _i = PyNumber_AsSsize_t(_key, PyExc_IndexError);
     if (_i < 0 || _i >= %CPPSELF.size()) {
@@ -969,7 +969,7 @@ if (PyIndex_Check(_key)) {
 // @snippet qbytearray-mgetitem
 
 // @snippet qbytearray-msetitem
-if (PyIndex_Check(_key)) {
+if (PepIndex_Check(_key)) {
     Py_ssize_t _i = PyNumber_AsSsize_t(_key, PyExc_IndexError);
     if (_i == -1 && PyErr_Occurred())
         return -1;
diff --git a/sources/pyside2/PySide2/support/deprecated.py b/sources/pyside2/PySide2/support/deprecated.py
index 57f33d9e..4f09244d 100644
--- a/sources/pyside2/PySide2/support/deprecated.py
+++ b/sources/pyside2/PySide2/support/deprecated.py
@@ -54,6 +54,8 @@ Note that this fixing code is run after all initializations, but before the
 import is finished. But that is no problem since the module is passed in.
 """
 
+import inspect
+import sys
 import warnings
 from textwrap import dedent
 
@@ -72,6 +74,32 @@ def constData(self):
     return cls.data(self)
 
 
+def apply_rlcompleter_patch():
+
+    def _callable_postfix(self, val, word):
+        if callable(val):
+            word += "("
+            try:
+                if not inspect.signature(val).parameters:
+                    word += ")"
+            except ValueError:
+                pass
+            # PYSIDE-2101: this line is added because inspect.signature cannot handle lists
+            except TypeError:
+                pass
+
+        return word
+
+    if sys.version_info[:2] >= (3, 10):
+        from rlcompleter import Completer
+        Completer._callable_postfix = _callable_postfix
+
+
+def fix_for_QtCore(QtCore):
+    # PYSIDE-2101: Fix rlcompleter until we evict the __signature__ attribute
+    apply_rlcompleter_patch()
+
+
 def fix_for_QtGui(QtGui):
     for name, cls in QtGui.__dict__.items():
         if name.startswith("QMatrix") and "data" in cls.__dict__:
diff --git a/sources/pyside2/pyside_version.py b/sources/pyside2/pyside_version.py
index 290c1dc1..ca635a72 100644
--- a/sources/pyside2/pyside_version.py
+++ b/sources/pyside2/pyside_version.py
@@ -39,7 +39,7 @@
 
 major_version = "5"
 minor_version = "15"
-patch_version = "12"
+patch_version = "13"
 
 # For example: "a", "b", "rc"
 # (which means "alpha", "beta", "release candidate").
diff --git a/sources/shiboken2/libshiboken/bindingmanager.cpp b/sources/shiboken2/libshiboken/bindingmanager.cpp
index 13e0f9e7..5f314754 100644
--- a/sources/shiboken2/libshiboken/bindingmanager.cpp
+++ b/sources/shiboken2/libshiboken/bindingmanager.cpp
@@ -43,6 +43,7 @@
 #include "bindingmanager.h"
 #include "sbkdbg.h"
 #include "gilstate.h"
+#include "helper.h"
 #include "sbkstring.h"
 #include "sbkstaticstrings.h"
 #include "debugfreehook.h"
@@ -123,7 +124,7 @@ public:
 #ifndef NDEBUG
 static void showWrapperMap(const WrapperMap &wrapperMap)
 {
-    if (Py_VerboseFlag > 0) {
+    if (Shiboken::pyVerbose() > 0) {
         fprintf(stderr, "-------------------------------\n");
         fprintf(stderr, "WrapperMap: %p (size: %d)\n", &wrapperMap, (int) wrapperMap.size());
         for (auto it = wrapperMap.begin(), end = wrapperMap.end(); it != end; ++it) {
diff --git a/sources/shiboken2/libshiboken/helper.cpp b/sources/shiboken2/libshiboken/helper.cpp
index b0f909d3..336b42b4 100644
--- a/sources/shiboken2/libshiboken/helper.cpp
+++ b/sources/shiboken2/libshiboken/helper.cpp
@@ -38,6 +38,7 @@
 ****************************************************************************/
 
 #include "helper.h"
+#include "pep384impl.h"
 #include "sbkstring.h"
 #include "sbkstaticstrings.h"
 
@@ -278,4 +279,25 @@ ThreadId mainThreadId()
     return _mainThreadId;
 }
 
+#if !defined(Py_LIMITED_API) && PY_VERSION_HEX >= 0x030A0000
+static int _getPyVerbose()
+{
+    PyConfig config;
+    PyConfig_InitPythonConfig(&config);
+    return config.verbose;
+}
+#endif // !Py_LIMITED_API >= 3.10
+
+int pyVerbose()
+{
+#ifdef Py_LIMITED_API
+    return Pep_GetVerboseFlag();
+#elif PY_VERSION_HEX >= 0x030A0000
+    static const int result = _getPyVerbose();
+    return result;
+#else
+    return Py_VerboseFlag;
+#endif
+}
+
 } // namespace Shiboken
diff --git a/sources/shiboken2/libshiboken/helper.h b/sources/shiboken2/libshiboken/helper.h
index 7e46f3d9..432a3ce5 100644
--- a/sources/shiboken2/libshiboken/helper.h
+++ b/sources/shiboken2/libshiboken/helper.h
@@ -96,6 +96,8 @@ using ThreadId = unsigned long long;
 LIBSHIBOKEN_API ThreadId currentThreadId();
 LIBSHIBOKEN_API ThreadId mainThreadId();
 
+LIBSHIBOKEN_API int pyVerbose();
+
 /**
  * An utility function used to call PyErr_WarnEx with a formatted message.
  */
diff --git a/sources/shiboken2/libshiboken/pep384_issue33738.cpp b/sources/shiboken2/libshiboken/pep384_issue33738.cpp
index c20edeef..aff91e8e 100644
--- a/sources/shiboken2/libshiboken/pep384_issue33738.cpp
+++ b/sources/shiboken2/libshiboken/pep384_issue33738.cpp
@@ -47,7 +47,8 @@
 // Simple solution: Create the structure and write such a function.
 // Long term: Submit a patch to python.org .
 
-// Update: I did the long-term solution for python 3.7 in issue 33738.
+// This structure comes from Python 3.7, but we have checked that
+// it also works for Python 3.8 and 3.9.
 
 typedef struct {
     /* Number implementations must check *both*
@@ -112,10 +113,45 @@ typedef struct _oldtypeobject {
 
 } PyOldTypeObject;
 
-int PyIndex_Check(PyObject *obj)
+static bool is_compatible_version()
 {
-    PyOldTypeObject *type = reinterpret_cast<PyOldTypeObject *>(Py_TYPE(obj));
-    return type->tp_as_number != NULL &&
-           type->tp_as_number->nb_index != NULL;
+    auto *sysmodule = PyImport_AddModule("sys");
+    auto *dic = PyModule_GetDict(sysmodule);
+    auto *version = PyDict_GetItemString(dic, "version_info");
+    auto *major = PyTuple_GetItem(version, 0);
+    auto *minor = PyTuple_GetItem(version, 1);
+    auto number = PyLong_AsLong(major) * 1000 + PyLong_AsLong(minor);
+    return number < 3010;
+}
+
+///////////////////////////////////////////////////////////////////////
+//
+// PYSIE-1797: The Solution
+// ========================
+//
+// Inspecting the data structures of Python 3.6, 3.7, 3.8 and 3.9
+// shows that concerning the here needed offset of nb_index, they
+// are all compatible.
+// That means: We can use the above definition for all these versions.
+//
+// From Python 3.10 on, the `PyType_GetSlot` function also works with
+// non-heap types. That means this solution will always work.
+//
+// Note: When we have moved to Python 3.8 as the minimum version,
+// this whole nonsense can be trashed.
+// There is an automatic warning about this in parser.py .
+//
+
+LIBSHIBOKEN_API int PepIndex_Check(PyObject *obj)
+{
+    static bool old_python_version = is_compatible_version();
+    if (old_python_version) {
+        auto *type = reinterpret_cast<PyOldTypeObject *>(Py_TYPE(obj));
+        return type->tp_as_number != nullptr &&
+               type->tp_as_number->nb_index != nullptr;
+    }
+    // From Python 3.10 on, we can use PyType_GetSlot also with normal types!
+    unaryfunc nb_index = reinterpret_cast<unaryfunc>(PyType_GetSlot(Py_TYPE(obj), Py_nb_index));
+    return nb_index != nullptr;
 }
 
diff --git a/sources/shiboken2/libshiboken/pep384impl.cpp b/sources/shiboken2/libshiboken/pep384impl.cpp
index fb28d883..d12dae39 100644
--- a/sources/shiboken2/libshiboken/pep384impl.cpp
+++ b/sources/shiboken2/libshiboken/pep384impl.cpp
@@ -188,9 +188,8 @@ check_PyTypeObject_valid()
     Py_DECREF(probe_tp_mro);
 }
 
-#if PY_VERSION_HEX < PY_ISSUE33738_SOLVED
+// PYSIDE-1797: This must be a runtime decision.
 #include "pep384_issue33738.cpp"
-#endif
 
 #endif // Py_LIMITED_API
 
diff --git a/sources/shiboken2/libshiboken/pep384impl.h b/sources/shiboken2/libshiboken/pep384impl.h
index eb65596c..b348943a 100644
--- a/sources/shiboken2/libshiboken/pep384impl.h
+++ b/sources/shiboken2/libshiboken/pep384impl.h
@@ -140,12 +140,17 @@ typedef struct _typeobject {
 #endif
 
 // This was a macro error in the limited API from the beginning.
-// It was fixed in Python master, but did make it only in Python 3.8 .
-#define PY_ISSUE33738_SOLVED 0x03080000
-#if PY_VERSION_HEX < PY_ISSUE33738_SOLVED
-#undef PyIndex_Check
-LIBSHIBOKEN_API int PyIndex_Check(PyObject *obj);
-#endif
+// It was fixed in Python master, but did make it only into Python 3.8 .
+
+// PYSIDE-1797: This must be a runtime decision.
+//              Remove that when the minimum Python version is 3.8,
+//              because the macro PepIndex_Check bug was fixed then.
+/// FIXME: Remove PepIndex_Check and pep384_issue33738.cpp when Python 3.7 is gone.
+LIBSHIBOKEN_API int PepIndex_Check(PyObject *obj);
+
+#else // Py_LIMITED_API
+
+#define PepIndex_Check(obj)               PyIndex_Check(obj)
 
 #endif // Py_LIMITED_API
 
@@ -331,11 +336,8 @@ LIBSHIBOKEN_API PyObject *PyRun_String(const char *, int, PyObject *, PyObject *
 // buffer functions.
 // But this is no problem as we check it's validity for every version.
 
-#define PYTHON_BUFFER_VERSION_COMPATIBLE    (PY_VERSION_HEX >= 0x03030000 && \
-                                             PY_VERSION_HEX <  0x030AFFFF)
-#if !PYTHON_BUFFER_VERSION_COMPATIBLE
-# error Please check the buffer compatibility for this python version!
-#endif
+// PYSIDE-1960 The buffer interface is since Python 3.11 part of the stable
+// API and we do not need to check the compatibility by hand anymore.
 
 typedef struct {
      getbufferproc bf_getbuffer;
diff --git a/sources/shiboken2/libshiboken/sbkconverter.cpp b/sources/shiboken2/libshiboken/sbkconverter.cpp
index 29eb1971..68ded778 100644
--- a/sources/shiboken2/libshiboken/sbkconverter.cpp
+++ b/sources/shiboken2/libshiboken/sbkconverter.cpp
@@ -377,7 +377,7 @@ SbkConverter *getConverter(const char *typeName)
     ConvertersMap::const_iterator it = converters.find(typeName);
     if (it != converters.end())
         return it->second;
-    if (Py_VerboseFlag > 0)
+    if (Shiboken::pyVerbose() > 0)
         SbkDbg() << "Can't find type resolver for type '" << typeName << "'.";
     return nullptr;
 }
diff --git a/sources/shiboken2/shiboken_version.py b/sources/shiboken2/shiboken_version.py
index 290c1dc1..ca635a72 100644
--- a/sources/shiboken2/shiboken_version.py
+++ b/sources/shiboken2/shiboken_version.py
@@ -39,7 +39,7 @@
 
 major_version = "5"
 minor_version = "15"
-patch_version = "12"
+patch_version = "13"
 
 # For example: "a", "b", "rc"
 # (which means "alpha", "beta", "release candidate").



More information about the Neon-commits mailing list