Zane Bitter <za...@fedoraproject.org> added the comment:

I also encountered this issue, and I'd like to further note that it is 
extraordinarily difficult to debug without access to stderr. If your logging 
facility uses the traceback module then it will be unable to record both the 
original (unhashable) exception, and the TypeError that it triggers (since the 
original exception is its __context__). The effect is that execution of a 
thread appears to simply stop without rhyme or reason (in fact it is still 
executing, but that fact is not apparent from the logs). I'm attaching a short 
reproducer that demonstrates this effect.

I believe the trade-offs inherent in the attached patches (either stopping the 
chain at an unhashable exception, or using a less-efficient data structure) can 
be avoided by comparing for identity rather than equality. The purpose of the 
check is to avoid an infinite loop; whether the objects compare as equal is 
something that is up to the author of the class, and has no relevance here 
except insofar as that objects ought to compare equal to themselves.

I submitted a pull request (#4014) with an implementation of that.

----------
nosy: +zaneb
Added file: https://bugs.python.org/file47223/hashex.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue28603>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to