[neon/forks/pyqt5/Neon/release-lts] debian: Backport upstream patch to make bound signals hashable.

Dmitry Shachnev null at kde.org
Wed May 26 11:29:29 BST 2021


Git commit c2c49468521c316e548cd16fdf221b45a87d4cdb by Dmitry Shachnev.
Committed on 18/09/2020 at 11:47.
Pushed by jriddell into branch 'Neon/release-lts'.

Backport upstream patch to make bound signals hashable.

M  +1    -0    debian/changelog
A  +66   -0    debian/patches/hashable_signals.diff
A  +1    -0    debian/patches/series

https://invent.kde.org/neon/forks/pyqt5/commit/c2c49468521c316e548cd16fdf221b45a87d4cdb

diff --git a/debian/changelog b/debian/changelog
index e5e6cc09..c8688a0a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,7 @@ pyqt5 (5.15.1+dfsg-1) UNRELEASED; urgency=medium
 
   [ Dmitry Shachnev ]
   * New upstream release.
+  * Backport upstream patch to make bound signals hashable.
 
   [ Alexander Volkov ]
   * Add python3-pyqt5.qtspeech package for QtTextToSpeech module.
diff --git a/debian/patches/hashable_signals.diff b/debian/patches/hashable_signals.diff
new file mode 100644
index 00000000..ebc7235c
--- /dev/null
+++ b/debian/patches/hashable_signals.diff
@@ -0,0 +1,66 @@
+From: Phil Thompson <phil at riverbankcomputing.com>
+Date: Fri, 18 Sep 2020 14:45:36 +0300
+Subject: Make bound signals hashable
+
+Origin: upstream, changeset 4318b62d0575
+---
+ qpy/QtCore/qpycore_pyqtboundsignal.cpp | 25 ++++++++++++++++++++++++-
+ 1 file changed, 24 insertions(+), 1 deletion(-)
+
+diff --git a/qpy/QtCore/qpycore_pyqtboundsignal.cpp b/qpy/QtCore/qpycore_pyqtboundsignal.cpp
+index 31fb819..b30cdc8 100644
+--- a/qpy/QtCore/qpycore_pyqtboundsignal.cpp
++++ b/qpy/QtCore/qpycore_pyqtboundsignal.cpp
+@@ -52,6 +52,7 @@ extern "C" {
+ static PyObject *pyqtBoundSignal_call(PyObject *self, PyObject *args,
+         PyObject *kw);
+ static void pyqtBoundSignal_dealloc(PyObject *self);
++static Py_hash_t pyqtBoundSignal_hash(PyObject *self);
+ static PyObject *pyqtBoundSignal_repr(PyObject *self);
+ static PyObject *pyqtBoundSignal_richcompare(PyObject *self, PyObject *other,
+         int op);
+@@ -139,6 +140,7 @@ static PyType_Slot qpycore_pyqtBoundSignal_Slots[] = {
+     {Py_tp_dealloc,     (void *)pyqtBoundSignal_dealloc},
+     {Py_tp_repr,        (void *)pyqtBoundSignal_repr},
+     {Py_tp_richcompare, (void *)pyqtBoundSignal_richcompare},
++    {Py_tp_hash,        (void *)pyqtBoundSignal_hash},
+     {Py_tp_call,        (void *)pyqtBoundSignal_call},
+     {Py_mp_subscript,   (void *)pyqtBoundSignal_mp_subscript},
+     {Py_tp_methods,     pyqtBoundSignal_methods},
+@@ -179,7 +181,7 @@ static PyTypeObject qpycore_pyqtBoundSignal_Type = {
+     0,                      /* tp_as_number */
+     0,                      /* tp_as_sequence */
+     &pyqtBoundSignal_as_mapping,    /* tp_as_mapping */
+-    0,                      /* tp_hash */
++    pyqtBoundSignal_hash,   /* tp_hash */
+     pyqtBoundSignal_call,   /* tp_call */
+     0,                      /* tp_str */
+     0,                      /* tp_getattro */
+@@ -315,6 +317,27 @@ static PyObject *pyqtBoundSignal_richcompare(PyObject *self, PyObject *other,
+ }
+ 
+ 
++// The type hash slot.
++static Py_hash_t pyqtBoundSignal_hash(PyObject *self)
++{
++    qpycore_pyqtBoundSignal *bs = (qpycore_pyqtBoundSignal *)self;
++
++    Py_hash_t signal_hash = PyObject_Hash((PyObject *)(bs->unbound_signal));
++    if (signal_hash == -1)
++        return -1;
++
++    Py_hash_t object_hash = PyObject_Hash((PyObject *)(bs->bound_pyobject));
++    if (object_hash == -1)
++        return -1;
++
++    Py_hash_t hash = signal_hash ^ object_hash;
++    if (hash == -1)
++        hash = -2;
++
++    return hash;
++}
++
++
+ // The type call slot.
+ static PyObject *pyqtBoundSignal_call(PyObject *self, PyObject *args,
+         PyObject *kw)
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 00000000..571798e7
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+hashable_signals.diff



More information about the Neon-commits mailing list