From: Rune F. <run...@us...> - 2005-01-12 23:27:35
|
I'm having a problem with pyPgSQL 2.4 under Python2.3. When the program terminates (normaly), a warning is triggered: Exception exceptions.AttributeError: "'NoneType' object has no attribute 'close'" in <bound method Connection.__del__ of <pyPgSQL.PgSQL.Connection instance at 0xb729aa8c>> ignored Adding some verbosity in PgSQL.py:Connection shows: In __closeCursors, self.cursors.data.values= [<weakref at 0xb732a70c; to 'instance' at 0xb715e84c>] In __closeCursors, self.cursors.data.values= [<weakref at 0xb72f4f04; to 'instance' at 0xb72fd46c>] In __del__ In __closeCursors, self.cursors.data.values= [<weakref at 0xb72f4f04; dead>] Note that in the two last calls, the weakref has the same address. The patch below handles this. Please let me know if you need further information. --- PgSQL.py.~1.35.~ 2003-07-14 23:19:20.000000000 +0200 +++ PgSQL.py 2005-01-13 00:06:42.000000000 +0100 @@ -2436,7 +2436,10 @@ curs = map(lambda x: x(), self.cursors.data.values()) for i in curs: - if flag: + if i is None: + pass # reference is dead + elif flag: i.close() else: i._Cursor__reset() Regards, Rune Frøysa |