From 5f51da4561599ce86e4aea5f05810949ccfca6e7 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 3 Oct 2022 20:55:56 -1000 Subject: [PATCH] fix: fix --- src/dbus_fast/message.pxd | 19 +++++++++++++++++-- src/dbus_fast/message.py | 13 +++++++++---- src/dbus_fast/signature.pxd | 2 -- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/dbus_fast/message.pxd b/src/dbus_fast/message.pxd index 57e1465c..c423ebcb 100644 --- a/src/dbus_fast/message.pxd +++ b/src/dbus_fast/message.pxd @@ -7,6 +7,21 @@ cdef unsigned int LITTLE_ENDIAN cdef unsigned int BIG_ENDIAN cdef unsigned int PROTOCOL_VERSION +cdef unsigned int HEADER_PATH +cdef unsigned int HEADER_INTERFACE +cdef unsigned int HEADER_MEMBER +cdef unsigned int HEADER_ERROR_NAME +cdef unsigned int HEADER_REPLY_SERIAL +cdef unsigned int HEADER_DESTINATION +cdef unsigned int HEADER_SIGNATURE +cdef unsigned int HEADER_UNIX_FDS + +cdef unsigned int METHOD_CALL +cdef unsigned int SIGNAL +cdef unsigned int ERROR +cdef unsigned int METHOD_RETURN + + cdef class Message: cdef public str destination @@ -16,13 +31,13 @@ cdef class Message: cdef public object message_type cdef public object flags cdef public str error_name - cdef public unsigned int reply_serial + cdef public object 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 + cdef public object serial @cython.locals( fields=cython.list, diff --git a/src/dbus_fast/message.py b/src/dbus_fast/message.py index 2634d97b..52bc3e04 100644 --- a/src/dbus_fast/message.py +++ b/src/dbus_fast/message.py @@ -21,6 +21,11 @@ HEADER_SIGNATURE = HeaderField.SIGNATURE.value HEADER_UNIX_FDS = HeaderField.UNIX_FDS.value +METHOD_CALL = MessageType.METHOD_CALL.value +SIGNAL = MessageType.SIGNAL.value +ERROR = MessageType.ERROR.value +METHOD_RETURN = MessageType.METHOD_RETURN.value + class Message: """A class for sending and receiving messages through the @@ -139,24 +144,24 @@ def __init__( if self.error_name is not None: assert_interface_name_valid(self.error_name) - if message_type == MessageType.METHOD_CALL: + if message_type == METHOD_CALL: if not path: raise InvalidMessageError(f"missing required field: path") if not member: raise InvalidMessageError(f"missing required field: member") - elif message_type == MessageType.SIGNAL: + elif message_type == SIGNAL: if not path: raise InvalidMessageError(f"missing required field: path") if not member: raise InvalidMessageError(f"missing required field: member") if not interface: raise InvalidMessageError(f"missing required field: interface") - elif message_type == MessageType.ERROR: + elif message_type == ERROR: if not error_name: raise InvalidMessageError(f"missing required field: error_name") if not reply_serial: raise InvalidMessageError(f"missing required field: reply_serial") - elif message_type == MessageType.METHOD_RETURN: + elif message_type == METHOD_RETURN: if not reply_serial: raise InvalidMessageError(f"missing required field: reply_serial") else: diff --git a/src/dbus_fast/signature.pxd b/src/dbus_fast/signature.pxd index 87180daf..402949d9 100644 --- a/src/dbus_fast/signature.pxd +++ b/src/dbus_fast/signature.pxd @@ -11,8 +11,6 @@ cdef class SignatureType: cdef _collapse(self) - cdef _parse_next(self) - cdef class SignatureTree: