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 ncoghlan
Recipients eric.smith, gpolo, hagen, ncoghlan
Date 2008-12-19.22:01:31
SpamBayes Score 0.00153811
Marked as misclassified No
Message-id <>
OK, the discrepancy with bytearray turns out to be fairly
straightforward: bytearray overrides the comparison operations, so
inheritance of the default object.__hash__ is automatically blocked.
range() objects don't support comparison, so they inherit __hash__ when
PyType_Ready is called.

Which then begs the question of why range() instances are unhashable
only until something happens to invoke the tp_getattro slot on the type
object... and it turns out that PyType_Ready isn't called on the type
during interpreter startup. Instead, it only happens lazily when one of
the operations that needs the tp_dict to be filled in calls PyType_Ready
(the default dir() retrieves __dict__ from the type object, and this
attribute access causes PyType_Ready to be called).

Only at this point is the slot inheritance on the range() type
calculated correctly.
Date User Action Args
2008-12-19 22:01:34ncoghlansetrecipients: + ncoghlan, eric.smith, gpolo, hagen
2008-12-19 22:01:34ncoghlansetmessageid: <>
2008-12-19 22:01:32ncoghlanlinkissue4701 messages
2008-12-19 22:01:31ncoghlancreate