This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author hagen
Recipients hagen
Date 2008-12-19.15:21:09
SpamBayes Score 2.3595608e-06
Marked as misclassified No
Message-id <1229700071.49.0.411961185177.issue4701@psf.upfronthosting.co.za>
In-reply-to
Content
As reported by Dmitry Vasiliev on python-dev, a range object suddenly
becomes hash()able after an attribute access, e.g. by dir().

If I understand correctly, then the reason is that PyRange_Type doesn't
set tp_hash and PyType_Ready is not normally called on the type, but
only e.g. in PyObject_GenericGetAttr.

I don't see any use for range objects being hashable, as they don't even
have meaningful equality defined on them. So I'd recommend making them
unhashable. The attached patch does this and adds a test.
History
Date User Action Args
2008-12-19 15:21:11hagensetrecipients: + hagen
2008-12-19 15:21:11hagensetmessageid: <1229700071.49.0.411961185177.issue4701@psf.upfronthosting.co.za>
2008-12-19 15:21:10hagenlinkissue4701 messages
2008-12-19 15:21:09hagencreate