Use py3k compatible .__getattr__() code
From the python-dev thread it seemed like using object.__getattribute__(self, 'name') is the cleanest way of implementing a class wich uses .__getattr__() and should be pickelable. That only works on new-style classes so this also turns HookProxy into a new-style class on py2. This also re-writes the test to not use cPickle so it runs on py3k.
This commit is contained in:
+1
-4
@@ -238,10 +238,7 @@ class EncodedFile(object):
|
||||
self.write(data)
|
||||
|
||||
def __getattr__(self, name):
|
||||
if hasattr(self, "buffer"):
|
||||
return getattr(self.buffer, name)
|
||||
else:
|
||||
raise AttributeError("attribute buffer of %r not set" % self)
|
||||
return getattr(object.__getattribute__(self, "buffer"), name)
|
||||
|
||||
|
||||
class MultiCapture(object):
|
||||
|
||||
Reference in New Issue
Block a user