]> granicus.if.org Git - python/commitdiff
Closes #13807: Merged fix from 3.1.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Fri, 20 Jan 2012 11:27:36 +0000 (11:27 +0000)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Fri, 20 Jan 2012 11:27:36 +0000 (11:27 +0000)
1  2 
Lib/logging/__init__.py

index 7dacddb066928593ebc1161faaf2105236c59508,f70dfb5239dae0a888eba0307e96e9700bb5baac..5f73ec22550de168b2b5b46cfc22cea8572837b3
@@@ -881,13 -721,10 +881,13 @@@ class Handler(Filterer)
          You could, however, replace this with a custom handler if you wish.
          The record which was being processed is passed in to this method.
          """
-         if raiseExceptions:
+         if raiseExceptions and sys.stderr:  # see issue 13807
              ei = sys.exc_info()
              try:
 -                traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr)
 +                traceback.print_exception(ei[0], ei[1], ei[2],
 +                                          None, sys.stderr)
 +                sys.stderr.write('Logged from file %s, line %s\n' % (
 +                                 record.filename, record.lineno))
              except IOError:
                  pass    # see issue 5971
              finally: