diff --git a/src/dbus_fast/_private/marshaller.pxd b/src/dbus_fast/_private/marshaller.pxd index 6995d687..958b8920 100644 --- a/src/dbus_fast/_private/marshaller.pxd +++ b/src/dbus_fast/_private/marshaller.pxd @@ -27,7 +27,7 @@ cdef class Marshaller: signature_len=cython.uint, written=cython.uint, ) - cpdef write_string(self, object value, object _type) + cpdef write_string(self, str value, object _type) @cython.locals( signature_len=cython.uint, @@ -59,6 +59,8 @@ cdef class Marshaller: @cython.locals( written=cython.uint, + signature=cython.str, + signature_bytes=cython.bytes, ) cpdef write_variant(self, object variant, object type) diff --git a/src/dbus_fast/_private/marshaller.py b/src/dbus_fast/_private/marshaller.py index ecfa2597..8ec71beb 100644 --- a/src/dbus_fast/_private/marshaller.py +++ b/src/dbus_fast/_private/marshaller.py @@ -63,7 +63,9 @@ def write_string(self, value, type_: SignatureType) -> int: return written def write_variant(self, variant: Variant, type_: SignatureType) -> int: - written = self._write_signature(variant.signature.encode()) + signature = variant.signature + signature_bytes = signature.encode() + written = self._write_signature(signature_bytes) written += self._write_single(variant.type, variant.value) return written