summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2011-12-13 17:22:22 -0500
committerBarry Warsaw <barry@python.org>2011-12-13 17:22:22 -0500
commite033b0c8f22a67abfe2ba1b61365d0c2570b7429 (patch)
treed2389b609482c2f0f49b211613e5b83d607dffb9
parent061e55e8edbfb457bf56194c52e7d7624855cf41 (diff)
downloaddbus-python-e033b0c8f22a67abfe2ba1b61365d0c2570b7429.tar.gz
Import threading instead of thread. The latter is gone in Python 3.
-rw-r--r--dbus/_dbus.py5
-rw-r--r--dbus/connection.py7
-rw-r--r--dbus/service.py7
3 files changed, 4 insertions, 15 deletions
diff --git a/dbus/_dbus.py b/dbus/_dbus.py
index d1df72e..bf0adaa 100644
--- a/dbus/_dbus.py
+++ b/dbus/_dbus.py
@@ -46,11 +46,6 @@ from _dbus_bindings import BUS_DAEMON_NAME, BUS_DAEMON_PATH,\
from dbus.bus import BusConnection
from dbus.lowlevel import SignalMessage
-try:
- import thread
-except ImportError:
- import dummy_thread as thread
-
class Bus(BusConnection):
"""A connection to one of three possible standard buses, the SESSION,
diff --git a/dbus/connection.py b/dbus/connection.py
index 10f03c7..89e9a2c 100644
--- a/dbus/connection.py
+++ b/dbus/connection.py
@@ -24,10 +24,7 @@ __all__ = ('Connection', 'SignalMatch')
__docformat__ = 'reStructuredText'
import logging
-try:
- import thread
-except ImportError:
- import dummy_thread as thread
+import threading
import weakref
from _dbus_bindings import Connection as _Connection, \
@@ -252,7 +249,7 @@ class Connection(_Connection):
"""Map from object path to dict mapping dbus_interface to dict
mapping member to list of SignalMatch objects."""
- self._signals_lock = thread.allocate_lock()
+ self._signals_lock = threading.Lock()
"""Lock used to protect signal data structures"""
self.add_message_filter(self.__class__._signal_func)
diff --git a/dbus/service.py b/dbus/service.py
index f1b3a9b..eebc949 100644
--- a/dbus/service.py
+++ b/dbus/service.py
@@ -29,11 +29,8 @@ __docformat__ = 'restructuredtext'
import sys
import logging
import operator
+import threading
import traceback
-try:
- import thread
-except ImportError:
- import dummy_thread as thread
import _dbus_bindings
from dbus import SessionBus, Signature, Struct, validate_bus_name, \
@@ -466,7 +463,7 @@ class Object(Interface):
#: is for future expansion (to support fallback paths)
self._locations = []
#: Lock protecting `_locations`, `_connection` and `_object_path`
- self._locations_lock = thread.allocate_lock()
+ self._locations_lock = threading.Lock()
#: True if this is a fallback object handling a whole subtree.
self._fallback = False