BaseProxyObject: lazily introspect children as needed
The D-Bus specification says:
“If a child <node> has any sub-elements, then they must represent a
complete introspection of the child. If a child <node> is empty, then
it may or may not have sub-elements; the child must be introspected
in order to find out. The intent is that if an object knows that its
children are "fast" to introspect it can go ahead and return their
information, but otherwise it can omit it.”
However, BaseProxyObject.get_children() has been assuming that all child
<node> elements provide a complete introspection of their corresponding
child objects. This causes child objects to appear to have no interfaces
or children of their own, even when they in fact do.
To implement the spec, replace BaseProxyObject.introspection with a
lazily-computed property whose value is initialized as the intr.Node
passed to the BaseProxyObject constructor (or parsed by it), if one was
specified, or is otherwise computed upon first use by introspecting the
child object (synchronously). The synchronous introspection required
pulling the introspect_sync method up from glib.MessageBus into
BaseMessageBus as an abstract method and then implementing it in
aio.MessageBus by using asyncio.loop.run_until_complete(…).
5f5ae14
6 days ago
by whitslack
+0.06%
chore(pre-commit.ci): auto fixes
0e7170c
6 days ago
by pre-commit-ci[bot]
+0.25%
chore: small fixes for python 3.9
1ca8a94
6 days ago
by bdraco
+0.37%
chore: fix introspection test on 3.9
e67505b
6 days ago
by bdraco
-0.34%
chore: alternative name owner tracking defeat to appease Cython
Cython demands that a dict-typed object really be a dict and not a
subclass, presumably because it wants to shortcut the virtual dispatch
and implement all the methods in native code. Thus, my first attempt at
defeating the name owner tracking in MessageBus was a non-starter. This
commit switches to a different strategy: pre-filling the mapping so that
get_interface() won't try to shoot off a GetNameOwner call to the bus.