From e033b0c8f22a67abfe2ba1b61365d0c2570b7429 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Tue, 13 Dec 2011 17:22:22 -0500 Subject: Import threading instead of thread. The latter is gone in Python 3. --- dbus/_dbus.py | 5 ----- dbus/connection.py | 7 ++----- dbus/service.py | 7 ++----- 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 -- cgit v1.2.1