summaryrefslogtreecommitdiff
path: root/dev-python/zeroconf/files/zeroconf-0.146.5-cython-3.1.patch
blob: 3e533ed28f6b35c6b6c774f630b037d0be439c09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
         )