From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 27 Jun 2023 17:35:48 +0000 (-0700) Subject: [3.12] IDLE: Condense run.main threading.Thread start. (GH-106125) (#106154) X-Git-Tag: v3.12.0b4~69 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=264b54bf51dfbc1c6901389eb4bf8c2f8ea542a7;p=thirdparty%2FPython%2Fcpython.git [3.12] IDLE: Condense run.main threading.Thread start. (GH-106125) (#106154) IDLE: Condense run.main threading.Thread start. (GH-106125) Use daemon argument added in 3.3 and directly call .start. Remove now unused 'sockthread' name. (cherry picked from commit eaa1eae55ea66d74c5303924320185dac74d4eb1) Co-authored-by: Terry Jan Reedy --- diff --git a/Lib/idlelib/run.py b/Lib/idlelib/run.py index 4ffc90ab0c85..53e80a9b4280 100644 --- a/Lib/idlelib/run.py +++ b/Lib/idlelib/run.py @@ -140,11 +140,12 @@ def main(del_exitfunc=False): capture_warnings(True) sys.argv[:] = [""] - sockthread = threading.Thread(target=manage_socket, - name='SockThread', - args=((LOCALHOST, port),)) - sockthread.daemon = True - sockthread.start() + threading.Thread(target=manage_socket, + name='SockThread', + args=((LOCALHOST, port),), + daemon=True, + ).start() + while True: try: if exit_now: