ldo / dbussy

Python binding for D-Bus using asyncio
91 stars 22 forks source link

unlisten_signal error #9

Closed jimparis closed 5 years ago

jimparis commented 6 years ago
if rulekey in listeners :
    listeners = listeners[rulekey]
    try :
        listeners.pop(listeners.index(func))
    except ValueError :
        pass
    #end try
    if len(listeners) == 0 :
        ignore = dbus.Error.init()
        self.connection.bus_remove_match \
          (
            _signal_rule(path, fallback, interface, name),
            ignore
          )
        del listeners[rulekey]

That del raises TypeError, because listeners is no longer the dictionary due to the assignment in line 2.

ldo commented 6 years ago

Just some confusion over the meaning of the listeners variable -- fixed in 9fa9c658cf4a31c1063d9a3580c51812794b4472. Thanks for the report.

Snevzor commented 5 years ago

Hello @ldo. When do you plan a new release? I'm suffering from the same issue but I don't want to fork.

ldo commented 5 years ago

Same issue with the current version?

Snevzor commented 5 years ago

@ido I guess you mean master? This issue was discovered after releasing version 1.1?

So from 1.1:

File "/home/sven/projects/dbussy-example/venv/lib/python3.5/site-packages/ravel.py", line 644, in unlisten_propchanged
    func = func,
  File "/home/sven/projects/dbussy-example/venv/lib/python3.5/site-packages/ravel.py", line 611, in unlisten_signal
    del listeners[rulekey]
TypeError: list indices must be integers or slices, not tuple

1.1 from master works

ldo commented 5 years ago

PyPI version is old, needs updating.