summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarthikeyan Singaravelan <tir.karthi@gmail.com>2021-05-25 10:36:04 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2021-05-28 11:04:41 -0400
commitdbf57e4a7b8f4061b735be8b24bbb880fb75802f (patch)
treee9f1b0f9113280f638e2e700523175eeb17353cb
parentf5c84d4f257b7368c355b1773e6ced6a6853c352 (diff)
downloaddogpile-cache-dbf57e4a7b8f4061b735be8b24bbb880fb75802f.tar.gz
Fix DeprecationWarning due to camelCase aliases in Python 3.10.
Fixed Python 3.10 deprecation warning involving threading. Pull request courtesy Karthikeyan Singaravelan. Fixes: #203 Closes: #204 Pull-request: https://github.com/sqlalchemy/dogpile.cache/pull/204 Pull-request-sha: 9e21b3a52c87d5ea4edc254fb9362fe4a27a2f67 Change-Id: I6f9a7c81e1248d5c5edb1d05d4bd7bf7d8695f53
-rw-r--r--docs/build/unreleased/203.rst6
-rw-r--r--dogpile/util/readwrite_lock.py10
2 files changed, 11 insertions, 5 deletions
diff --git a/docs/build/unreleased/203.rst b/docs/build/unreleased/203.rst
new file mode 100644
index 0000000..11bbc80
--- /dev/null
+++ b/docs/build/unreleased/203.rst
@@ -0,0 +1,6 @@
+.. change::
+ :tags: bug, general
+ :tickets: 203
+
+ Fixed Python 3.10 deprecation warning involving threading. Pull request
+ courtesy Karthikeyan Singaravelan.
diff --git a/dogpile/util/readwrite_lock.py b/dogpile/util/readwrite_lock.py
index 4d93406..3f37510 100644
--- a/dogpile/util/readwrite_lock.py
+++ b/dogpile/util/readwrite_lock.py
@@ -62,10 +62,10 @@ class ReadWriteMutex(object):
# check if we are the last asynchronous reader thread
# out the door.
if self.async_ == 0:
- # yes. so if a sync operation is waiting, notifyAll to wake
+ # yes. so if a sync operation is waiting, notify_all to wake
# it up
if self.current_sync_operation is not None:
- self.condition.notifyAll()
+ self.condition.notify_all()
elif self.async_ < 0:
raise LockError(
"Synchronizer error - too many "
@@ -95,7 +95,7 @@ class ReadWriteMutex(object):
# establish ourselves as the current sync
# this indicates to other read/write operations
# that they should wait until this is None again
- self.current_sync_operation = threading.currentThread()
+ self.current_sync_operation = threading.current_thread()
# now wait again for asyncs to finish
if self.async_ > 0:
@@ -117,7 +117,7 @@ class ReadWriteMutex(object):
"""Release the 'write' lock."""
self.condition.acquire()
try:
- if self.current_sync_operation is not threading.currentThread():
+ if self.current_sync_operation is not threading.current_thread():
raise LockError(
"Synchronizer error - current thread doesn't "
"have the write lock"
@@ -128,7 +128,7 @@ class ReadWriteMutex(object):
self.current_sync_operation = None
# tell everyone to get ready
- self.condition.notifyAll()
+ self.condition.notify_all()
log.debug("%s released write lock", self)
finally: