Summary: | Cannot call overloaded dbus methods using dbus-python | ||
---|---|---|---|
Product: | dbus | Reporter: | himthingwatsit |
Component: | python | Assignee: | Simon McVittie <smcv> |
Status: | RESOLVED FIXED | QA Contact: | John (J5) Palmieri <johnp> |
Severity: | normal | ||
Priority: | medium | ||
Version: | unspecified | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Bug Depends on: | 36206 | ||
Bug Blocks: | |||
Attachments: |
allows dbus-python users to call overloaded methods
allows dbus-python users to call overloaded methods |
Description
himthingwatsit
2011-03-01 22:19:16 UTC
Created attachment 44007 [details] [review] allows dbus-python users to call overloaded methods The original patch would raise an exception complaining about ambiguous method calls if there were multiple candidate methods. ie if we have an interface defining the methods: Blah(string) Blah(int32) Blah(int64) then calling Blah(123) would raise an exception because it can't tell whether to call Blah(int32) or Blah(int64). I removed this because it may break some pre-existing scripts. It will now just call the last valid method. I think the only correct way to call an overloaded method would be to use signature='x' explicitly, but that's blocked by Bug #36206. I think the right way to call overloaded methods is to use the new support for the signature='x' keyword argument (which will be available from dbus-python 0.84 onewards) on method calls: "explicit is better than implicit" and "when faced with ambiguity, resist the temptation to guess". So you'd use: myproxy.Blah('foo', signature='s') myproxy.Blah(42, signature='i') This bypasses introspection completely (which is good, because dbus-python's existing use of introspection also violates those design principles). |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.