Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cython extension for messages #73

Merged
merged 1 commit into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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