Skip to content

Commit

Permalink
feat: add cython extension for messages (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Oct 5, 2022
1 parent 5db5156 commit 8676f12
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def build(setup_kwargs):
dict(
ext_modules=cythonize(
[
"src/dbus_fast/message.py",
"src/dbus_fast/signature.py",
"src/dbus_fast/unpack.py",
"src/dbus_fast/_private/marshaller.py",
Expand Down
23 changes: 23 additions & 0 deletions src/dbus_fast/message.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""cdefs for message.py"""

import cython


cdef class Message:

cdef public str destination
cdef public str path
cdef public str interface
cdef public str member
cdef public object message_type
cdef public object flags
cdef public str error_name
cdef public unsigned int reply_serial
cdef public str sender
cdef public list unix_fds
cdef public str signature
cdef public object signature_tree
cdef public list body
cdef public unsigned int serial

cpdef _marshall(self, negotiate_unix_fd: bint)
4 changes: 2 additions & 2 deletions src/dbus_fast/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def __init__(
self.error_name = (
error_name if type(error_name) is not ErrorType else error_name.value
)
self.reply_serial = reply_serial
self.reply_serial = reply_serial or 0
self.sender = sender
self.unix_fds = unix_fds
if type(signature) is SignatureTree:
Expand All @@ -131,7 +131,7 @@ def __init__(
self.signature = signature
self.signature_tree = get_signature_tree(signature)
self.body = body
self.serial = serial
self.serial = serial or 0

if not validate:
return
Expand Down

0 comments on commit 8676f12

Please sign in to comment.