Author: phd
Date: 2008-04-14 08:32:42 -0600 (Mon, 14 Apr 2008)
New Revision: 3380
Modified:
SQLObject/branches/0.9/docs/News.txt
SQLObject/branches/0.9/sqlobject/declarative.py
Log:
Reverted the patch N 1407684 (declarative.threadSafeMethod()) - it causes more harm then good.
Modified: SQLObject/branches/0.9/docs/News.txt
===================================================================
--- SQLObject/branches/0.9/docs/News.txt 2008-04-13 00:55:25 UTC (rev 3379)
+++ SQLObject/branches/0.9/docs/News.txt 2008-04-14 14:32:42 UTC (rev 3380)
@@ -14,6 +14,9 @@
* A minor bug was fixed in col.py - the registry must be passed to findClass().
+* Reverted the patch declarative.threadSafeMethod() - it causes more harm
+ then good.
+
SQLObject 0.9.5
===============
@@ -376,9 +379,6 @@
* Fixed a bug with default field values for columns for Firebird connection.
-* Prevent a deadlock in declarative.threadSafeMethod() by not reacquiring
- the class lock.
-
* Fixed a bug in col.createSQL().
* Fixed a bug in converting date/time for years < 1000 (time.strptime()
Modified: SQLObject/branches/0.9/sqlobject/declarative.py
===================================================================
--- SQLObject/branches/0.9/sqlobject/declarative.py 2008-04-13 00:55:25 UTC (rev 3379)
+++ SQLObject/branches/0.9/sqlobject/declarative.py 2008-04-14 14:32:42 UTC (rev 3380)
@@ -33,12 +33,11 @@
"""
from __future__ import generators
-import threading
+import copy
import events
__all__ = ('classinstancemethod', 'DeclarativeMeta', 'Declarative')
-import copy
try:
import itertools
@@ -86,25 +85,6 @@
return ('<bound method %s.%s of %r>'
% (self.type.__name__, self.func.func_name, self.obj))
-def threadSafeMethod(lock):
- def decorator(fn):
- def _wrapper(self, *args, **kwargs):
- # This prevents deadlocks.
- # The class lock isn't really needed in __init__() while fetching.
- if '_SO_fetch_no_create' in kwargs:
- return fn(self, *args, **kwargs)
- lock.acquire()
- try:
- return fn(self, *args, **kwargs)
- finally:
- lock.release()
- try:
- _wrapper.func_name = fn.func_name
- except TypeError:
- pass
- return _wrapper
- return decorator
-
class DeclarativeMeta(type):
def __new__(meta, class_name, bases, new_attrs):
@@ -119,9 +99,6 @@
if new_attrs.has_key('__classinit__'):
cls.__classinit__ = staticmethod(cls.__classinit__.im_func)
cls.__classinit__(cls, new_attrs)
- if new_attrs.has_key('__init__'):
- lock = threading.RLock()
- cls.__init__ = threadSafeMethod(lock)(cls.__init__)
for func in post_funcs:
func(cls)
return cls
|