diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-21 19:08:00 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-09-21 19:08:00 (GMT) |
commit | 91943460b54c20fda330d78a6b8d7643ef838b4e (patch) | |
tree | 16a463cf38352fca8dd2ae7c9e48ad9a6b85a9a5 /Lib/threading.py | |
parent | 3e46d7cba27f5636ba16c37651ba4ff6371e1a50 (diff) | |
download | cpython-91943460b54c20fda330d78a6b8d7643ef838b4e.zip cpython-91943460b54c20fda330d78a6b8d7643ef838b4e.tar.gz cpython-91943460b54c20fda330d78a6b8d7643ef838b4e.tar.bz2 |
Issue #22423: Unhandled exception in thread no longer causes unhandled
AttributeError when sys.stderr is None.
Diffstat (limited to 'Lib/threading.py')
-rw-r--r-- | Lib/threading.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/threading.py b/Lib/threading.py index e81471b..0438e1f 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -818,10 +818,10 @@ class Thread(_Verbose): # shutdown) use self.__stderr. Otherwise still use sys (as in # _sys) in case sys.stderr was redefined since the creation of # self. - if _sys: - _sys.stderr.write("Exception in thread %s:\n%s\n" % - (self.name, _format_exc())) - else: + if _sys and _sys.stderr is not None: + print>>_sys.stderr, ("Exception in thread %s:\n%s" % + (self.name, _format_exc())) + elif self.__stderr is not None: # Do the best job possible w/o a huge amt. of code to # approximate a traceback (code ideas from # Lib/traceback.py) |