[Python-Dev] StreamHandler eating exceptions

Guido van Rossum guido at python.org
Mon Oct 31 16:26:26 CET 2005


I wonder if, once PEP 352 is accepted, this shouldn't be changed so
that there is only one except clause instead of two, and it says
"except Exception:". This has roughly the same effect as the proposed
(and already applied) patch, but does it in a Python-3000-compatible
way. ATM it is less robust because it doesn't catch exceptions that
don't derive from Exception -- but in all cases where this particular
try/except has saved my butt (yes it has! multiple times! :-), the
exception thrown was a standard exception.

(Did anybody else notice the synchronicity of this request with the
PEP 352 discussion?)

On 10/31/05, Vinay Sajip <vinay_sajip at yahoo.co.uk> wrote:
> Gustavo Niemeyer <gustavo <at> niemeyer.net> writes:
>
> >
> > The StreamHandler available under the logging package is currently
> > catching all exceptions under the emit() method call. In the
> > Handler.handleError() documentation it's mentioned that it's
> > implemented like that because users do not care about errors
> > in the logging system.
> >
> > I'd like to apply the following patch:
> [patch snipped]
> > Anyone against the change?
> >
>
> Good idea. I've checked into svn a patch for both logging/__init__.py and
> logging/handlers.py which raises both KeyboardInterrupt and SystemExit raised
> during emit().
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org
>


--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list