remoteproxy.py crashes under Python 3.3

Bug #1209065 reported by Richard-027
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pyqtgraph
New
Undecided
Unassigned

Bug Description

When trying to run the RemoteSpeedTest example under Python 3.3, line 517 of remoteproxy.py throws the error:

self.proxies[ref] = proxy._proxyId
TypeError: unhashable type: 'ObjectProxy'

I was able to get it working for me by replacing line 516 with:

ref = WeakMethod(weakref.ref, [proxy, self.deleteProxy])

and by defining 'WeakMethod' with:

if sys.version < '3':
    def WeakMethod(self, args):
        return weakref.ref(*args)
else:
    class WeakMethod:
        def __init__(self, inst, method_name):
            self.proxy = weakref.proxy(inst)
            self.method_name = method_name

        def __call__(self, *args):
            return getattr(self.proxy, self.method_name)(*args)

(based on the fix described at http://jderose.blogspot.co.nz/2012/04/how-to-create-weak-reference-to.html)

No idea if that's the best approach but it seems to do the job

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.