1. Luca Wehrstedt
  2. sqlalchemy

Commits

Mike Bayer  committed 788c75d

removed needless "thread" imports from util

  • Participants
  • Parent commits 383a721
  • Branches default

Comments (0)

Files changed (5)

File lib/sqlalchemy/engine/threadlocal.py

View file
         """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:

File lib/sqlalchemy/pool.py

View file
 
 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 = {}
 

File lib/sqlalchemy/queue.py

View file
 """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
 
 from collections import deque
 from time import time as _time
-
+from sqlalchemy.util import threading
 
 __all__ = ['Empty', 'Full', '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

File lib/sqlalchemy/schema.py

View file
     def __init__(self):
         """Construct a ThreadLocalMetaData."""
 
-        self.context = util.ThreadLocal()
+        self.context = util.threading.local()
         self.__engines = {}
         super(ThreadLocalMetaData, self).__init__()
 

File lib/sqlalchemy/util.py

View file
 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)