[New-bugs-announce] [issue13360] UnicodeWarning raised on dict() and set()

Florent Xicluna report at bugs.python.org
Sun Nov 6 21:22:12 CET 2011


New submission from Florent Xicluna <florent.xicluna at gmail.com>:

The UnicodeWarning is raised on some dict or set operations.
It is not very helpful, and sometimes annoying.
And it is somewhat inconsistent.


# ** warning not raised **

$ python2.7 -c "print u'd\xe9' in {'foo', 'bar'}"
False
$ python2.7 -c "print 'd\xe9' in {u'foo', u'bar'}"
False
$ python2.7 -c "print 'd\xc3\xa9' in {u'foo', u'd\xe9'}"
False


# ** warning raised **

$ python2.7 -c "print 'd\xe9' in {u'foo', u'd\xe9'}"
-c:1: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
False
$ python2.7 -c "print u'd\xe9' in {'foo', 'd\xe9'}"
-c:1: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
False

----------
components: Unicode
messages: 147181
nosy: ezio.melotti, flox
priority: normal
severity: normal
status: open
title: UnicodeWarning raised on dict() and set()
type: behavior
versions: Python 2.7

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


More information about the New-bugs-announce mailing list