]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
removed needless "thread" imports from util
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 30 May 2009 01:09:16 +0000 (01:09 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 30 May 2009 01:09:16 +0000 (01:09 +0000)
lib/sqlalchemy/engine/threadlocal.py
lib/sqlalchemy/pool.py
lib/sqlalchemy/queue.py
lib/sqlalchemy/schema.py
lib/sqlalchemy/util.py

index 23c9cd0c1e36db4da88c9e71e2d5672cc48fa85f..8ad14ad35f096fe7b9432d28c19321649d512948 100644 (file)
@@ -172,7 +172,7 @@ class TLEngine(base.Engine):
         """Construct a new TLEngine."""
 
         super(TLEngine, self).__init__(*args, **kwargs)
-        self.context = util.ThreadLocal()
+        self.context = util.threading.local()
 
         proxy = kwargs.get('proxy')
         if proxy:
index dabc2929eeb55082171f432f4315ea4373317cac..2eabd857272a30eb24b3901098e90a52510d3e76 100644 (file)
@@ -20,7 +20,7 @@ import weakref, time, threading
 
 from sqlalchemy import exc, log
 from sqlalchemy import queue as Queue
-from sqlalchemy.util import thread, threading, pickle, as_interface
+from sqlalchemy.util import threading, pickle, as_interface
 
 proxies = {}
 
index 37e772547d3fe3f8f8f417c14f6465af21bfe85a..c9ab82acf8a3b40f9fa87f20e4c768aff50096db 100644 (file)
@@ -1,7 +1,7 @@
 """An adaptation of Py2.3/2.4's Queue module which supports reentrant
 behavior, using RLock instead of Lock for its mutex object.
 
-This is to support the connection pool's usage of ``__del__`` to return
+This is to support the connection pool's usage of weakref callbacks to return
 connections to the underlying Queue, which can apparently in extremely
 rare cases be invoked within the ``get()`` method of the Queue itself,
 producing a ``put()`` inside the ``get()`` and therefore a reentrant
@@ -9,7 +9,7 @@ condition."""
 
 from collections import deque
 from time import time as _time
-
+from sqlalchemy.util import threading
 
 __all__ = ['Empty', 'Full', 'Queue']
 
@@ -30,10 +30,6 @@ class Queue:
         If `maxsize` is <= 0, the queue size is infinite.
         """
 
-        try:
-            import threading
-        except ImportError:
-            import dummy_threading as threading
         self._init(maxsize)
         # mutex must be held whenever the queue is mutating.  All methods
         # that acquire mutex must release it before returning.  mutex
index 47c01024c7c48ea52fcdeb2015a96884d4a513a0..2ec359f381229e11a90ca609a7f7c859305f9605 100644 (file)
@@ -1833,7 +1833,7 @@ class ThreadLocalMetaData(MetaData):
     def __init__(self):
         """Construct a ThreadLocalMetaData."""
 
-        self.context = util.ThreadLocal()
+        self.context = util.threading.local()
         self.__engines = {}
         super(ThreadLocalMetaData, self).__init__()
 
index dbc7d3ea48a2dce6aa63ea260c836611b082bc1e..8eeeda45559ce2bd378dde2a7869929e3e013bdf 100644 (file)
@@ -11,12 +11,9 @@ types = __import__('types')
 from sqlalchemy import exc
 
 try:
-    import thread, threading
-    from threading import local as ThreadLocal
+    import threading
 except ImportError:
-    import dummy_thread as thread
     import dummy_threading as threading
-    from dummy_threading import local as ThreadLocal
 
 py3k = getattr(sys, 'py3kwarning', False) or sys.version_info >= (3, 0)