On Tue, 30 Aug 2016 12:22:10 -0500 Justin Pryzby <[email protected]> wrote: > I believe this is triggering infinite recursion: > > pg.py class DB: > > def __getattr__(self, name): > # All undefined members are same as in underlying connection: > if self.db: > return getattr(self.db, name) > > "if self.db" seems to be itself calling getattr (?)
I do not believe that this is correct. First, I think that you mean that "self.db" calls __getattr__ as getattr would only be called if self.db was not True. However, since self.db always exists __getattr__ doesn't get called. It is only invoked if the attribute wasn't found the usual ways. You may be thinking of __getattribute__ which always gets called. Do you have a code snippet that you think is triggering an infinite recursion here? Is it possible that your code is deleting db as in "del MyInstance.db"? That would do it but is wrong. Even in the package we never delete it. We only set it to None when the object is no longer valid. Cheers. -- D'Arcy J.M. Cain PyGreSQL Development Group http://www.PyGreSQL.org IM:[email protected] _______________________________________________ PyGreSQL mailing list [email protected] https://mail.vex.net/mailman/listinfo.cgi/pygresql
