| Index: third_party/tlslite/tlslite/basedb.py
|
| diff --git a/third_party/tlslite/tlslite/basedb.py b/third_party/tlslite/tlslite/basedb.py
|
| index 4988c1501ccec097a7a255d7ef1817041eceebb3..e6b79442f70462eceb4c40b3558281fd27b7ca8e 100644
|
| --- a/third_party/tlslite/tlslite/basedb.py
|
| +++ b/third_party/tlslite/tlslite/basedb.py
|
| @@ -1,9 +1,19 @@
|
| +# Authors:
|
| +# Trevor Perrin
|
| +# Martin von Loewis - python 3 port
|
| +#
|
| +# See the LICENSE file for legal information regarding use of this file.
|
| +
|
| """Base class for SharedKeyDB and VerifierDB."""
|
|
|
| -import anydbm
|
| -import thread
|
| +try:
|
| + import anydbm
|
| +except ImportError:
|
| + # Python 3
|
| + import dbm as anydbm
|
| +import threading
|
|
|
| -class BaseDB:
|
| +class BaseDB(object):
|
| def __init__(self, filename, type):
|
| self.type = type
|
| self.filename = filename
|
| @@ -11,7 +21,7 @@ class BaseDB:
|
| self.db = None
|
| else:
|
| self.db = {}
|
| - self.lock = thread.allocate_lock()
|
| + self.lock = threading.Lock()
|
|
|
| def create(self):
|
| """Create a new on-disk database.
|
| @@ -117,4 +127,4 @@ class BaseDB:
|
| finally:
|
| self.lock.release()
|
| usernames = [u for u in usernames if not u.startswith("--Reserved--")]
|
| - return usernames
|
| + return usernames
|
|
|