New submission from Guido van Rossum:

I just noticed that StreamHandler contains the following fragment in its emit() 
method:

  try:
    <do some writing>
  except (KeyboardInterrupt, SystemExit): #pragma: no cover                
    raise
  except:
    self.handleError(record)

Couldn't this be simplified to the following?

  try:
    <do some writing>
  except Exception:
    self.handleError(record)

I.e. instead of manually catching and re-raising a few BaseExceptions, just 
don't catch anything that derives from BaseException but not from Exception?

(I noticed because we have an internal clone of this class that occasionally 
gets augmented with yet another base exception that shouldn't be handled.

----------
components: Library (Lib)
messages: 172087
nosy: gvanrossum
priority: normal
severity: normal
status: open
title: Possible simplification for logging.StreamHandler exception handling
type: behavior
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16141>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to