[ python-Bugs-1460886 ] Broken __hash__ for Unicode objects
SourceForge.net
noreply at sourceforge.net
Wed Mar 29 21:16:26 CEST 2006
Bugs item #1460886, was opened at 2006-03-29 19:16
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1460886&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Unicode
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Joe Wreschnig (piman)
Assigned to: M.-A. Lemburg (lemburg)
Summary: Broken __hash__ for Unicode objects
Initial Comment:
http://docs.python.org/ref/customization.html says
equal objects should hash to the same value. But this
is not the case when the default Unicode encoding has
been changed (by e.g. importing PyGTK).
Using Python 2.4.2:
>>> import sys
>>> reload(sys)
<module 'sys' (built-in)>
>>> sys.setdefaultencoding('utf-8')
>>> hash(u"\u1234"), hash(str(u"\u1234"))
(-518661067, -1855038154)
>>> u"\u1234" == str(u"\u1234")
True
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1460886&group_id=5470
More information about the Python-bugs-list
mailing list