[New-bugs-announce] [issue3772] logging module fails with non-ascii data

Mark Hammond report at bugs.python.org
Thu Sep 4 05:47:15 CEST 2008

New submission from Mark Hammond <mhammond at users.sourceforge.net>:

It appears r66103 introduced a regression - file objects are treated as
having an encoding, so non-ascii data fails.  It was further complicated
by the fact that file objects in 2.6 have an 'encoding' attribute, but
by default it is None - so a 'hasattr' check for encoding doesn't work
the same.

The fix is quite trivial and I also added a new test to demonstrate the
error - but for the impatient, you can reproduce it via:

import logging
log = logging.getLogger("test")

In all earlier versions of Python, the bytes as specified are written. 
2.6 complains that 'None' is not a valid encoding and fails to write the

assignee: vsajip
components: Library (Lib)
keywords: patch
messages: 72478
nosy: mhammond, vsajip
priority: release blocker
severity: normal
status: open
title: logging module fails with non-ascii data
type: behavior
versions: Python 2.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list