diff --git a/1961.patch b/1961.patch new file mode 100644 index 0000000..0dc615c --- /dev/null +++ b/1961.patch @@ -0,0 +1,29 @@ +From 82831563d02f0c1cc4887173c00fd04308bb4804 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Mon, 11 Mar 2024 09:54:57 +0100 +Subject: [PATCH] Don't fail when logging.Logger.warn is not available + +Python 3.13 removed it. + +See https://github.com/python/cpython/issues/105376 +--- + zmq/log/handlers.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/zmq/log/handlers.py b/zmq/log/handlers.py +index 841d80524..88fe571ca 100644 +--- a/zmq/log/handlers.py ++++ b/zmq/log/handlers.py +@@ -218,7 +218,11 @@ def log(self, level, topic, msg, *args, **kwargs): + # Generate the methods of TopicLogger, since they are just adding a + # topic prefix to a message. + for name in "debug warn warning error critical fatal".split(): +- meth = getattr(logging.Logger, name) ++ try: ++ meth = getattr(logging.Logger, name) ++ except AttributeError: ++ # some methods are missing, e.g. Logger.warn was removed from Python 3.13 ++ continue + setattr( + TopicLogger, + name, diff --git a/python-zmq.spec b/python-zmq.spec index 7949ee8..b819c9e 100644 --- a/python-zmq.spec +++ b/python-zmq.spec @@ -15,6 +15,9 @@ License: MPLv2.0 and ASL 2.0 and BSD URL: https://zeromq.org/languages/python/ Source0: %{pypi_source pyzmq} +# Python 3.13 compatibility +Patch: https://github.com/zeromq/pyzmq/pull/1961.patch + BuildRequires: gcc BuildRequires: pkgconfig(libzmq) @@ -58,7 +61,7 @@ This package contains the testsuite for the python bindings. %prep -%setup -q -n pyzmq-%{version} +%autosetup -p1 -n pyzmq-%{version} # Upstream is testing with cython 3 on 3.12 sed -i -e '/cython>=3/d' pyproject.toml test-requirements.txt