[c-c] fix RuntimeError: 'maximum recursion depth exceeded while calling a Python object' we get when creating/upgrading/shelling an instance: hasattr() call __getattribute__, creating an infinite recursion error catched by the interpretor. Avoid this by testing the method is available on the class instead of the instance
--- a/migration.py Wed Sep 29 12:18:06 2010 +0200
+++ b/migration.py Wed Sep 29 12:44:11 2010 +0200
@@ -129,7 +129,8 @@
return object.__getattribute__(self, name)
except AttributeError:
cmd = 'cmd_%s' % name
- if hasattr(self, cmd):
+ # search self.__class__ to avoid infinite recursion
+ if hasattr(self.__class__, cmd):
meth = getattr(self, cmd)
return lambda *args, **kwargs: self.interact(args, kwargs,
meth=meth)