[Jython-checkins] jython: Do not clobber main thread name if set by user

jim.baker jython-checkins at python.org
Wed Jan 28 03:51:15 CET 2015


https://hg.python.org/jython/rev/c512d451b76e
changeset:   7560:c512d451b76e
user:        Jim Baker <jim.baker at rackspace.com>
date:        Tue Jan 27 19:41:13 2015 -0700
summary:
  Do not clobber main thread name if set by user

files:
  Lib/threading.py |  8 +++++++-
  1 files changed, 7 insertions(+), 1 deletions(-)


diff --git a/Lib/threading.py b/Lib/threading.py
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -274,7 +274,13 @@
 
 class _MainThread(Thread):
     def __init__(self):
-        Thread.__init__(self, name="MainThread")
+        if java.lang.Thread.currentThread().name == "main":
+            # Do not clobber the thread name if the user set it to
+            # something different
+            kw = dict(name="MainThread")
+        else:
+            kw = {}
+        Thread.__init__(self, **kw)
         import atexit
         atexit.register(self.__exitfunc)
 

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list