[issue20537] logging exc_info parameter should accept exception instances

Yury Selivanov report at bugs.python.org
Fri Feb 7 00:53:08 CET 2014


New submission from Yury Selivanov:

A bunch of logging methods accept optional parameter exc_info, that is supposed to be either 'True' or a tuple of three elements (type, exc, tb).

If, however, someone passes an actual exception instance, Logger._log function will interpret it as True and get the current exception from sys.exc_info, ignoring the passed exception completely.

Attached is a patch that fixes this: if exc_info is an instance of BaseException, Logger._log creates the tuple out of it automatically.

----------
files: logging_01.patch
keywords: patch
messages: 210428
nosy: vinay.sajip, yselivanov
priority: normal
severity: normal
status: open
title: logging exc_info parameter should accept exception instances
type: enhancement
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file33950/logging_01.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20537>
_______________________________________


More information about the Python-bugs-list mailing list