Skip to content

Commit dbf57e4

Browse files
tirkarthizzzeek
authored andcommitted
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: #204 Pull-request-sha: 9e21b3a Change-Id: I6f9a7c81e1248d5c5edb1d05d4bd7bf7d8695f53
1 parent f5c84d4 commit dbf57e4

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

docs/build/unreleased/203.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. change::
2+
:tags: bug, general
3+
:tickets: 203
4+
5+
Fixed Python 3.10 deprecation warning involving threading. Pull request
6+
courtesy Karthikeyan Singaravelan.

dogpile/util/readwrite_lock.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ def release_read_lock(self):
6262
# check if we are the last asynchronous reader thread
6363
# out the door.
6464
if self.async_ == 0:
65-
# yes. so if a sync operation is waiting, notifyAll to wake
65+
# yes. so if a sync operation is waiting, notify_all to wake
6666
# it up
6767
if self.current_sync_operation is not None:
68-
self.condition.notifyAll()
68+
self.condition.notify_all()
6969
elif self.async_ < 0:
7070
raise LockError(
7171
"Synchronizer error - too many "
@@ -95,7 +95,7 @@ def acquire_write_lock(self, wait=True):
9595
# establish ourselves as the current sync
9696
# this indicates to other read/write operations
9797
# that they should wait until this is None again
98-
self.current_sync_operation = threading.currentThread()
98+
self.current_sync_operation = threading.current_thread()
9999

100100
# now wait again for asyncs to finish
101101
if self.async_ > 0:
@@ -117,7 +117,7 @@ def release_write_lock(self):
117117
"""Release the 'write' lock."""
118118
self.condition.acquire()
119119
try:
120-
if self.current_sync_operation is not threading.currentThread():
120+
if self.current_sync_operation is not threading.current_thread():
121121
raise LockError(
122122
"Synchronizer error - current thread doesn't "
123123
"have the write lock"
@@ -128,7 +128,7 @@ def release_write_lock(self):
128128
self.current_sync_operation = None
129129

130130
# tell everyone to get ready
131-
self.condition.notifyAll()
131+
self.condition.notify_all()
132132

133133
log.debug("%s released write lock", self)
134134
finally:

0 commit comments

Comments
 (0)