From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 27 Jun 2023 17:37:20 +0000 (-0700) Subject: [3.11] IDLE: Condense run.main threading.Thread start. (GH-106125) (#106153) X-Git-Tag: v3.11.5~249 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fbb0151e5ec14e2db5699bdb7adcc19d3c0b7267;p=thirdparty%2FPython%2Fcpython.git [3.11] IDLE: Condense run.main threading.Thread start. (GH-106125) (#106153) 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 59198b6c6fc1..9830e2b5be44 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: