From c45c924a2de4d8c153800e9a31a28e4d569d8280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= 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 )