Skip to content

Commit 4b4c56d

Browse files
smuth4jonathanslenders
authored andcommitted
Fix currentThread() deprecation warning
`DeprecationWarning: currentThread() is deprecated, use current_thread() instead`
1 parent f1b2e6b commit 4b4c56d

File tree

1 file changed

+2
-4
lines changed
  • src/prompt_toolkit/shortcuts/progress_bar

1 file changed

+2
-4
lines changed

src/prompt_toolkit/shortcuts/progress_bar/base.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
from prompt_toolkit.layout.dimension import AnyDimension, D
5353
from prompt_toolkit.output import ColorDepth, Output
5454
from prompt_toolkit.styles import BaseStyle
55+
from prompt_toolkit.utils import in_main_thread
5556

5657
from .formatters import Formatter, create_default_formatters
5758

@@ -147,10 +148,7 @@ def __init__(
147148
# If no `cancel_callback` was given, and we're creating the progress
148149
# bar from the main thread. Cancel by sending a `KeyboardInterrupt` to
149150
# the main thread.
150-
if (
151-
self.cancel_callback is None
152-
and threading.currentThread() == threading.main_thread()
153-
):
151+
if self.cancel_callback is None and in_main_thread():
154152

155153
def keyboard_interrupt_to_main_thread() -> None:
156154
os.kill(os.getpid(), signal.SIGINT)

0 commit comments

Comments
 (0)