From: Mike C. F. <mcf...@ro...> - 2004-01-22 06:26:17
|
There's a bug in the __closeCursors function, line 2437 in PgSQL.py. The code is dereferencing a weakref, which, if the object has been gc'd returns None, but the code doesn't check to see that the returned value is not None. I've just encountered a situation where a None in present in the stream, so at least in some situations it can occur :) . def __closeCursors(self, flag=0): """ __closeCursors() - closes all cursors associated with this connection""" if self.__anyLeft(): if noWeakRef: curs = self.cursors[:] else: curs = map(lambda x: x(), self.cursors.data.values()) for i in curs: if flag: i.close() else: i._Cursor__reset() return self.inTransaction the if weakRef clause should read: curs = filter( None, map(lambda x: x(), self.cursors.data.values())) or, if we want to use list comprehensions: curs = [y for y in [ x() for x in self.cursors.data.values() ] if y ] or we can just do: for i in curs: if i: ... Enjoy, Mike _______________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://members.rogers.com/mcfletch/ |