summaryrefslogtreecommitdiff
path: root/bin/sql_db.py
diff options
context:
space:
mode:
authorP. Christeas <p_christ@hol.gr>2009-04-20 20:20:16 +0300
committerP. Christeas <p_christ@hol.gr>2009-04-20 20:20:16 +0300
commit79d62886715d113d945a2f1c0b4469b811741fe0 (patch)
tree7d36d75325afbe2cd9e1e675425652b0cf81e472 /bin/sql_db.py
parentc64ae0b8d1cd014bf5fa653c0aca46f5393b47ba (diff)
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
Diffstat (limited to 'bin/sql_db.py')
-rw-r--r--bin/sql_db.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/sql_db.py b/bin/sql_db.py
index 8fa364b9410..93e95e82bfb 100644
--- a/bin/sql_db.py
+++ b/bin/sql_db.py
@@ -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,