From c9bfdf391f3f069e9a33088d74c8ff9d502dba9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=CC=B7N=CC=B7?= <6h8fn1zo@duck.com> Date: Sat, 10 Jun 2023 07:56:34 +0700 Subject: [PATCH 1/3] Fix deprecated threading.getName() threading.getName() is deprecated as for Python 3.10. Use name attribute "threading.name" instead. https://stackoverflow.com/a/69656065 https://stackoverflow.com/a/69656065 --- src/nohang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nohang b/src/nohang index c47f39b..cbb968b 100755 --- a/src/nohang +++ b/src/nohang @@ -237,11 +237,11 @@ def start_thread(func, *a, **k): """ run function in a new thread """ th = threading.Thread(target=func, args=a, kwargs=k, daemon=True) - th_name = th.getName() + th_name = th.name if debug_threading: log('Starting {} from {}'.format( - th_name, threading.current_thread().getName() + th_name, threading.current_thread().name )) try: From 72600a425137d1b1fd1dc9fe628e3125bdcacdea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=CC=B7N=CC=B7?= <6h8fn1zo@duck.com> Date: Sat, 10 Jun 2023 08:06:37 +0700 Subject: [PATCH 2/3] Fix deprecated sre_constants sre_constants is deprecated in favor of re. --- src/nohang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nohang b/src/nohang index cbb968b..dfb7df8 100755 --- a/src/nohang +++ b/src/nohang @@ -7,7 +7,7 @@ from time import sleep, monotonic from operator import itemgetter from sys import stdout, stderr, argv, exit from re import search -from sre_constants import error as invalid_re +from re import error as invalid_re from signal import signal, SIGKILL, SIGTERM, SIGINT, SIGQUIT, SIGHUP, SIGUSR1 From 3bf53467666188c8bd184211d1fa304b5ee53e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=CC=B7N=CC=B7?= <6h8fn1zo@duck.com> Date: Sat, 10 Jun 2023 13:30:47 +0700 Subject: [PATCH 3/3] Another threading.getName() to .name attribute --- src/nohang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nohang b/src/nohang index dfb7df8..73e0322 100755 --- a/src/nohang +++ b/src/nohang @@ -209,7 +209,7 @@ def exe(cmd): cmd_num_dict['cmd_num'] += 1 cmd_num = cmd_num_dict['cmd_num'] - th_name = threading.current_thread().getName() + th_name = threading.current_thread().name log('Executing Command-{} {} with timeout {}s in {}'.format( cmd_num, @@ -350,7 +350,7 @@ def pop(cmd): else: wait_time = 30 - th_name = threading.current_thread().getName() + th_name = threading.current_thread().name log('Executing Command-{} {} with timeout {}s in {}'.format( cmd_num,