diff --git a/.gitignore b/.gitignore index 025b031..013139d 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,4 @@ /kombu-5.3.0b3.tar.gz /kombu-5.3.1.tar.gz /kombu-5.3.2.tar.gz +/kombu-5.3.4.tar.gz diff --git a/3ad075a536d177170a7a5d7b04d81e94bd5bf404.patch b/3ad075a536d177170a7a5d7b04d81e94bd5bf404.patch deleted file mode 100644 index 94ef6a9..0000000 --- a/3ad075a536d177170a7a5d7b04d81e94bd5bf404.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 3ad075a536d177170a7a5d7b04d81e94bd5bf404 Mon Sep 17 00:00:00 2001 -From: Peter Marheine -Date: Wed, 18 Oct 2023 20:45:10 +1100 -Subject: [PATCH] Create a lock on cached_property if not present (#1811) - -* Create a lock on cached_property if not present - -This fixes #1804 (fixing breakage caused by use of undocumented -implementation details of functools.cached_property) by ensuring a lock -is always present on cached_property attributes, which is required to -safely support setting and deleting cached values in addition to -computing them on demand. - -* Add a unit test for cached_property locking ---- - kombu/utils/objects.py | 11 ++++++++++- - t/unit/utils/test_objects.py | 32 ++++++++++++++++++++++++++++++++ - 2 files changed, 42 insertions(+), 1 deletion(-) - -diff --git a/kombu/utils/objects.py b/kombu/utils/objects.py -index 737a94529..862f914b3 100644 ---- a/kombu/utils/objects.py -+++ b/kombu/utils/objects.py -@@ -2,6 +2,8 @@ - - from __future__ import annotations - -+from threading import RLock -+ - __all__ = ('cached_property',) - - try: -@@ -25,10 +27,17 @@ def __init__(self, fget=None, fset=None, fdel=None): - # This is a backport so we set this ourselves. - self.attrname = self.func.__name__ - -+ if not hasattr(self, 'lock'): -+ # Prior to Python 3.12, functools.cached_property has an -+ # undocumented lock which is required for thread-safe __set__ -+ # and __delete__. Create one if it isn't already present. -+ self.lock = RLock() -+ - def __get__(self, instance, owner=None): - # TODO: Remove this after we drop support for Python<3.8 - # or fix the signature in the cached_property package -- return super().__get__(instance, owner) -+ with self.lock: -+ return super().__get__(instance, owner) - - def __set__(self, instance, value): - if instance is None: -diff --git a/t/unit/utils/test_objects.py b/t/unit/utils/test_objects.py -index b9f1484a5..e2d1619ec 100644 ---- a/t/unit/utils/test_objects.py -+++ b/t/unit/utils/test_objects.py -@@ -1,5 +1,7 @@ - from __future__ import annotations - -+from unittest import mock -+ - from kombu.utils.objects import cached_property - - -@@ -51,3 +53,33 @@ def foo(self, value): - assert x.xx == 10 - - del x.foo -+ -+ def test_locks_on_access(self): -+ -+ class X: -+ @cached_property -+ def foo(self): -+ return 42 -+ -+ x = X() -+ -+ # Getting the value acquires the lock, and may do so recursively -+ # on Python < 3.12 because the superclass acquires it. -+ with mock.patch.object(X.foo, 'lock') as mock_lock: -+ assert x.foo == 42 -+ mock_lock.__enter__.assert_called() -+ mock_lock.__exit__.assert_called() -+ -+ # Setting a value also acquires the lock. -+ with mock.patch.object(X.foo, 'lock') as mock_lock: -+ x.foo = 314 -+ assert x.foo == 314 -+ mock_lock.__enter__.assert_called_once() -+ mock_lock.__exit__.assert_called_once() -+ -+ # .. as does clearing the cached value to recompute it. -+ with mock.patch.object(X.foo, 'lock') as mock_lock: -+ del x.foo -+ assert x.foo == 42 -+ mock_lock.__enter__.assert_called_once() -+ mock_lock.__exit__.assert_called_once() diff --git a/7187021ecc9f65601c50754d0fc6ec6c5264eea1.patch b/7187021ecc9f65601c50754d0fc6ec6c5264eea1.patch deleted file mode 100644 index b313242..0000000 --- a/7187021ecc9f65601c50754d0fc6ec6c5264eea1.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 7187021ecc9f65601c50754d0fc6ec6c5264eea1 Mon Sep 17 00:00:00 2001 -From: Asif Saif Uddin -Date: Wed, 18 Oct 2023 16:14:16 +0600 -Subject: [PATCH] using assert_called_once() in est__pop_ready_uses_lock - (#1813) - ---- - t/unit/asynchronous/test_hub.py | 2 +- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/t/unit/asynchronous/test_hub.py b/t/unit/asynchronous/test_hub.py -index e46d338df..97551dd1d 100644 ---- a/t/unit/asynchronous/test_hub.py -+++ b/t/unit/asynchronous/test_hub.py -@@ -568,4 +568,4 @@ def test__pop_ready_pops_ready_items(self): - def test__pop_ready_uses_lock(self): - with patch.object(self.hub, '_ready_lock', autospec=True) as lock: - self.hub._pop_ready() -- assert lock.__enter__.called_once() -+ lock.__enter__.assert_called_once() -diff --git a/t/unit/asynchronous/test_hub.py b/t/unit/asynchronous/test_hub.py -index 27b048b94..e46d338df 100644 ---- a/t/unit/asynchronous/test_hub.py -+++ b/t/unit/asynchronous/test_hub.py -@@ -193,7 +193,7 @@ def test_call_soon_uses_lock(self): - callback = Mock(name='callback') - with patch.object(self.hub, '_ready_lock', autospec=True) as lock: - self.hub.call_soon(callback) -- assert lock.__enter__.called_once() -+ lock.__enter__.assert_called_once() - - def test_call_soon__promise_argument(self): - callback = promise(Mock(name='callback'), (1, 2, 3)) diff --git a/python-kombu.spec b/python-kombu.spec index acddb55..7a644ad 100644 --- a/python-kombu.spec +++ b/python-kombu.spec @@ -2,7 +2,7 @@ %global srcname kombu # Packaging unstable? # %%global prerel b3 -%global general_version 5.3.2 +%global general_version 5.3.4 %global upstream_version %{general_version}%{?prerel} Name: python-%{srcname} @@ -16,12 +16,6 @@ License: BSD and Python URL: http://kombu.readthedocs.org/ Source0: https://github.com/celery/kombu/archive/v%{upstream_version}/%{srcname}-%{upstream_version}.tar.gz -# Python 3.12: https://github.com/celery/kombu/commit/3ad075a536d177170a7a5d7b04d81e94bd5bf404 -Patch01: 3ad075a536d177170a7a5d7b04d81e94bd5bf404.patch - -# Python 3.12: https://github.com/celery/kombu/commit/7187021ecc9f65601c50754d0fc6ec6c5264eea1 -# and part of https://github.com/celery/kombu/commit/6c8e7e6b2815ae03eb77f7625c3c196e0390a749 -Patch02: 7187021ecc9f65601c50754d0fc6ec6c5264eea1.patch BuildArch: noarch diff --git a/qpid-transport-works-with-celery-4.patch b/qpid-transport-works-with-celery-4.patch deleted file mode 100644 index bf527f1..0000000 --- a/qpid-transport-works-with-celery-4.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/kombu/transport/qpid.py b/kombu/transport/qpid.py -index 2204624..35da356 100644 ---- a/kombu/transport/qpid.py -+++ b/kombu/transport/qpid.py -@@ -850,7 +850,7 @@ def basic_get(self, queue, no_ack=False, **kwargs): - except Empty: - pass - -- def basic_ack(self, delivery_tag): -+ def basic_ack(self, delivery_tag, multiple=False): - """Acknowledge a message by delivery_tag. - - Acknowledges a message referenced by delivery_tag. Messages can -@@ -864,8 +864,12 @@ def basic_ack(self, delivery_tag): - :param delivery_tag: The delivery tag associated with the message - to be acknowledged. - :type delivery_tag: uuid.UUID -+ :param multiple: not implemented. If set to True an AssertionError -+ is raised. -+ :type multiple: bool - - """ -+ assert multiple is False - self.qos.ack(delivery_tag) - - def basic_reject(self, delivery_tag, requeue=False): diff --git a/sources b/sources index ec161cd..c923688 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (kombu-5.3.2.tar.gz) = c7a760c1340a775ca204c04e5aa11b27c713c9d75b2160f9f7ef9f165f8df076f50cc01e70a471f94269c1613aec26547f07f60f4cdd2190395211c77c594632 +SHA512 (kombu-5.3.4.tar.gz) = 2336af0e099b8b111ec3c53874d2fbf5bcad889c0413e33d6aaf3072d985fe2a24d80320997b4ecf22175362e4354029225547d91eb1bf73da69cfbd8629f70e