Skip to content

Commit bee7a74

Browse files
committed
chore: speed up DNSQuestion creation as well
1 parent 3ffc4b4 commit bee7a74

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/zeroconf/_protocol/incoming.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ cdef class DNSIncoming:
9797
)
9898
cdef void _read_others(self)
9999

100-
@cython.locals(offset="unsigned int")
100+
@cython.locals(offset="unsigned int", question=DNSQuestion)
101101
cdef _read_questions(self)
102102

103103
@cython.locals(

src/zeroconf/_protocol/incoming.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ def _read_questions(self) -> None:
246246
# The question has 2 unsigned shorts in network order
247247
type_ = view[offset] << 8 | view[offset + 1]
248248
class_ = view[offset + 2] << 8 | view[offset + 3]
249-
question = DNSQuestion(name, type_, class_)
249+
question = DNSQuestion.__new__(DNSQuestion)
250+
question._fast_init(name, type_, class_)
250251
if question.unique: # QU questions use the same bit as unique
251252
self._has_qu_question = True
252253
questions.append(question)

0 commit comments

Comments
 (0)