Skip to content

Commit 4df0ae4

Browse files
authored
Merge pull request #1465 from tirkarthi/fix-threading
Use current_thread instead of currentThread method that was deprecated in Python 3.10
2 parents e9eebfb + 8f4bc86 commit 4df0ae4

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

debug_toolbar/panels/logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ def process_request(self, request):
7878

7979
def generate_stats(self, request, response):
8080
records = collector.get_collection()
81-
self._records[threading.currentThread()] = records
81+
self._records[threading.current_thread()] = records
8282
collector.clear_collection()
8383
self.record_stats({"records": records})

debug_toolbar/panels/staticfiles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def process_request(self, request):
118118

119119
def generate_stats(self, request, response):
120120
used_paths = collector.get_collection()
121-
self._paths[threading.currentThread()] = used_paths
121+
self._paths[threading.current_thread()] = used_paths
122122

123123
self.record_stats(
124124
{

debug_toolbar/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,14 @@ def get_collection(self, thread=None):
252252
is provided, returns a list for the current thread.
253253
"""
254254
if thread is None:
255-
thread = threading.currentThread()
255+
thread = threading.current_thread()
256256
if thread not in self.collections:
257257
self.collections[thread] = []
258258
return self.collections[thread]
259259

260260
def clear_collection(self, thread=None):
261261
if thread is None:
262-
thread = threading.currentThread()
262+
thread = threading.current_thread()
263263
if thread in self.collections:
264264
del self.collections[thread]
265265

0 commit comments

Comments
 (0)