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

marshal.sigFromPy assumes all python ints to be 'i', which is not the case... #40

Open
abferm opened this issue Jul 26, 2016 · 3 comments

Comments

@abferm
Copy link

abferm commented Jul 26, 2016

I have noticed several errors when I try to return a large int from a dbus method who's return signature is a variant or dictionary of variants. Python ints are C longs, and can contain larger values than will fit in 'i'. A simple size check for integers in sigFromPy would be easy to implement and solve this problem. A less elegant solution would be to change the default assignment to 'x', but that would result in larger messages in many cases.

@abferm
Copy link
Author

abferm commented Jul 26, 2016

For the short term, is there a way for me to return pre-marshaled variants?

Example:
def dbus_GetSomeValue(self, value_name): return marshal.marshal_variant(sig, big_number)

@gardarh
Copy link

gardarh commented Dec 20, 2016

This causes another issue: when calling a remote method that has a uint32 signature txdbus infers that the value is int32 and replaces the variant signature with "i" as instead of "u". Possible fixes may be:

  1. Provide a way to pass wrapped primitives to callRemote, e.g.:

class WrappedPrimitive(object): def __init__(self, val, sig): self.val = val self.sig = sig

sigFromPy already has a mechanism to extract explicit signature but I can't see that it works with RemoteDBusObject.callRemote()

  1. Allow explicit signature definition from callRemote().

I thought this was easy and tried to pass the signature explicitly to RemoteDBusObject.objHandler.conn.callRemote() but got an error:

RemoteError: org.freedesktop.DBus.Error.UnknownMethod: Method "Set" with signature "ssu" on interface "org.freedesktop.DBus.Properties" doesn't exist

since DBus.Properties.Set requires a ssv signature.

I could implement either of these solutions or any other but some guiding would be really helpful :)

@cocagne
Copy link
Owner

cocagne commented Dec 22, 2016 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants