dev-python/zeroconf: Apply a workaround for Cython-3.1 issues

Bug: https://bugs.gentoo.org/954107
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2025-05-03 14:29:38 +02:00
parent 4dbb2bc461
commit 4aca62fd57
2 changed files with 47 additions and 1 deletions

View File

@@ -0,0 +1,41 @@
From c45c924a2de4d8c153800e9a31a28e4d569d8280 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Sat, 3 May 2025 14:26:57 +0200
Subject: [PATCH] Workaround Cython-3.1 problems
Disable the use of type annotations since they are often incorrect
upstream, and workaround one other problem caused by wrong annotations.
---
build_ext.py | 2 +-
src/zeroconf/_services/browser.py | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/build_ext.py b/build_ext.py
index ff088f8..7ebe344 100644
--- a/build_ext.py
+++ b/build_ext.py
@@ -62,7 +62,7 @@ def build(setup_kwargs: Any) -> None:
{
"ext_modules": cythonize(
EXTENSIONS,
- compiler_directives={"language_level": "3"}, # Python 3
+ compiler_directives={"language_level": "3", "annotation_typing": False}, # Python 3
),
"cmdclass": {"build_ext": BuildExt},
}
diff --git a/src/zeroconf/_services/browser.py b/src/zeroconf/_services/browser.py
index ab8c050..6af2af8 100644
--- a/src/zeroconf/_services/browser.py
+++ b/src/zeroconf/_services/browser.py
@@ -394,7 +394,10 @@ class QueryScheduler:
refresh_time_millis: float_,
) -> None:
"""Schedule a query for a pointer."""
- ttl = int(pointer.ttl) if isinstance(pointer.ttl, float) else pointer.ttl
+ if isinstance(pointer.ttl, float):
+ ttl = int(pointer.ttl)
+ else:
+ ttl = pointer.ttl
scheduled_ptr_query = _ScheduledPTRQuery(
pointer.alias, pointer.name, ttl, expire_time_millis, refresh_time_millis
)

View File

@@ -5,7 +5,7 @@ EAPI=8
DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=poetry
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_COMPAT=( python3_{11..13} )
inherit distutils-r1 pypi
@@ -36,6 +36,11 @@ distutils_enable_tests pytest
export REQUIRE_CYTHON=1
PATCHES=(
# https://bugs.gentoo.org/954107 (workaround)
"${FILESDIR}/zeroconf-0.146.5-cython-3.1.patch"
)
python_test() {
local -x SKIP_IPV6=1
local EPYTEST_DESELECT=(