Repository navigation
mockobject: Drop _wrap_in_dbus_variant from UpdateProperties; Fix property values with UnixFd, containers, or nested variants - #254
Merged
Conversation
Matching the serialized XML in `test_introspection_properties` was already brittle and does not scale to checking more properties. Parse it with ElementTree instead.
…riants Storing a property value unwrapped it with `copy.copy()`, to get the actual type instead of "v" in introspection. That failed for UnixFd values with "cannot pickle 'dbus.UnixFd' object", flattened nested variants (variant_level 2 or more) to their content, and was skipped for Array and Dictionary values, so that these got introspected as `v`. Only unwrap values with exactly one variant level, which is the one that comes from the AddProperty() and UpdateProperties() D-Bus arguments. Do that explicitly for each kind of type.
The `PropertiesChanged` signal of `UpdateProperties()` failed for UnixFd
values ("Argument is not int and does not implement fileno() method"),
flattened nested variants, and rejected plain Python types like int,
bool, or list ("could not wrap type"), which templates pass when calling
it directly.
Wrapping the values into variants is redundant: since commit c9567f3,
EmitSignal() converts its arguments with Message.append() according to
the "sa{sv}as" signature, which already wraps the a{sv} values. The
bluez5 template already relies on that. So send the stored values as
they are.
Thanks to Lars Smith Eier for pointing this out!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks to Lars Smith Eier @leierx for pointing this out in #252!