[issue34752] warnings.warn fails silently with unicode input

Karthikeyan Singaravelan report at bugs.python.org
Mon Sep 24 07:14:17 EDT 2018


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

I think this a known limitation as per https://bugs.python.org/issue23637#msg239361 where non-ASCII characters would require byte string. I couldn't find the relevant documentation for it though.

$ ./python.exe
Python 2.7.15+ (remotes/upstream/2.7:69d0bc1430, Sep 24 2018, 16:02:09)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import warnings
>>>
>>> warnings.warn(b'blé')
__main__:1: UserWarning: blé
>>> warnings.warn(u'blé')
>>>

Thanks

----------

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


More information about the Python-bugs-list mailing list