[New-bugs-announce] [issue34752] warnings.warn fails silently with unicode input

Nicholas Parslow report at bugs.python.org
Thu Sep 20 10:15:37 EDT 2018


New submission from Nicholas Parslow <nick.parslow at soapboxlabs.com>:

example:

Python 2.7.14 |Anaconda, Inc.| (default, Dec  7 2017, 17:05:42) 
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import warnings
>>> warnings.warn(u'blé')
>>> warnings.warn('blah')
__main__:1: UserWarning: blah

the warnings.warn_explicit function seems to be the part that is failing. On a machine which doesn't use anaconda it fails in an identical manner.

if you do:
>>> with warnings.catch_warnings(record=True) as w:
...   warnings.warn(u'blé')
... 
>>> w
[<warnings.WarningMessage object at 0x7ffadb35b190>]
>>> w[0].message
UserWarning(u'bl\xe9',)


I can get that it fails with unicode (though it's annoying) but the silent fail is really bad imo.

----------
components: Extension Modules
messages: 325880
nosy: nparslow
priority: normal
severity: normal
status: open
title: warnings.warn fails silently with unicode input
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34752>
_______________________________________


More information about the New-bugs-announce mailing list