Skip to content

Commit b9a2c0c

Browse files
committed
feature: avoid more py types
1 parent af92f6b commit b9a2c0c

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

src/zeroconf/_protocol/outgoing.pxd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ cdef class DNSOutgoing:
3131
cdef public cython.dict names
3232
cdef public cython.list data
3333
cdef public unsigned int size
34-
cdef public object allow_long
34+
cdef public bint allow_long
3535
cdef public object state
3636
cdef public cython.list questions
3737
cdef public cython.list answers
@@ -48,18 +48,18 @@ cdef class DNSOutgoing:
4848

4949
cdef _write_int(self, object value)
5050

51-
cdef _write_question(self, DNSQuestion question)
51+
cdef cython.bint _write_question(self, DNSQuestion question)
5252

5353
@cython.locals(
5454
d=cython.bytes,
5555
data_view=cython.list,
5656
length=cython.uint
5757
)
58-
cdef _write_record(self, DNSRecord record, object now)
58+
cdef cython.bint _write_record(self, DNSRecord record, object now)
5959

6060
cdef _write_record_class(self, DNSEntry record)
6161

62-
cdef _check_data_limit_or_rollback(self, object start_data_length, object start_size)
62+
cdef cython.bint _check_data_limit_or_rollback(self, cython.uint start_data_length, cython.uint start_size)
6363

6464
cdef _write_questions_from_offset(self, object questions_offset)
6565

src/zeroconf/_protocol/outgoing.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ def write_name(self, name: str_) -> None:
294294

295295
def _write_question(self, question: DNSQuestion_) -> bool:
296296
"""Writes a question to the packet"""
297-
start_data_length, start_size = len(self.data), self.size
297+
start_data_length = len(self.data)
298+
start_size = self.size
298299
self.write_name(question.name)
299300
self.write_short(question.type)
300301
self._write_record_class(question)
@@ -315,7 +316,8 @@ def _write_record(self, record: DNSRecord_, now: float_) -> bool:
315316
"""Writes a record (answer, authoritative answer, additional) to
316317
the packet. Returns True on success, or False if we did not
317318
because the packet because the record does not fit."""
318-
start_data_length, start_size = len(self.data), self.size
319+
start_data_length = len(self.data)
320+
start_size = self.size
319321
self.write_name(record.name)
320322
self.write_short(record.type)
321323
self._write_record_class(record)

0 commit comments

Comments
 (0)