Major fix for Python 2.6: fix db cursor speed like 2.5

In python 2.6, the hasattr() will undergo subclass checks. So, it is
unwise to call it for the "object". That subclass check would overflow
the recursion limit, on each cursor delete operation, which ends up in
wasted CPU (and slow OpenObject responsiveness).

Now, hopefully, OpenObject will run in 2.6 as fast as it ran in 2.5 .

bzr revid: p_christ@hol.gr-20090420172016-1dgiys0cj90efh34
This commit is contained in:
P. Christeas 2009-04-20 20:20:16 +03:00
parent c64ae0b8d1
commit 79d6288671
1 changed files with 1 additions and 1 deletions

View File

@ -91,7 +91,7 @@ class Cursor(object):
self.__caller = tuple(stack()[2][1:3])
def __del__(self):
if hasattr(self, '_obj'):
if hasattr(self.__dict__, '_obj'):
if tools.config['log_level'] in (netsvc.LOG_DEBUG, netsvc.LOG_DEBUG_RPC):
# Oops. 'self' has not been closed explicitly.
# The cursor will be deleted by the garbage collector,