Skip to content

Commit 90815d9

Browse files
tirkarthinedbat
authored andcommitted
Use current_thread instead of currentThread that was deprecated in Python 3.10
1 parent 05fbe9c commit 90815d9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

coverage/pytracer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def log(self, marker, *args):
8585
if 0:
8686
f.write(".{:x}.{:x}".format(
8787
self.thread.ident,
88-
self.threading.currentThread().ident,
88+
self.threading.current_thread().ident,
8989
))
9090
f.write(" {}".format(" ".join(map(str, args))))
9191
if 0:
@@ -220,9 +220,9 @@ def start(self):
220220
self.stopped = False
221221
if self.threading:
222222
if self.thread is None:
223-
self.thread = self.threading.currentThread()
223+
self.thread = self.threading.current_thread()
224224
else:
225-
if self.thread.ident != self.threading.currentThread().ident:
225+
if self.thread.ident != self.threading.current_thread().ident:
226226
# Re-starting from a different thread!? Don't set the trace
227227
# function, but we are marked as running again, so maybe it
228228
# will be ok?
@@ -243,7 +243,7 @@ def stop(self):
243243
# right thread.
244244
self.stopped = True
245245

246-
if self.threading and self.thread.ident != self.threading.currentThread().ident:
246+
if self.threading and self.thread.ident != self.threading.current_thread().ident:
247247
# Called on a different thread than started us: we can't unhook
248248
# ourselves, but we've set the flag that we should stop, so we
249249
# won't do any more tracing.

tests/test_concurrency.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ def test_coverage_stop_in_threads():
518518
def run_thread(): # pragma: nested
519519
"""Check that coverage is stopping properly in threads."""
520520
deadline = time.time() + 5
521-
ident = threading.currentThread().ident
521+
ident = threading.current_thread().ident
522522
if sys.gettrace() is not None:
523523
has_started_coverage.append(ident)
524524
while sys.gettrace() is not None:

0 commit comments

Comments
 (0)