[Python-3000] Where is PyUnicodeObject->hash supposed to be set? (original) (raw)

Nicholas Bastin nick.bastin at gmail.com
Fri Sep 7 20:30:33 CEST 2007


Before I do a bunch of searching around in the source, perhaps someone just knows the answer to this question.

A quick trip through the debugger indicates that the reason PyDict_GetItem is being called 5 million times more often in PyEval_EvalFrameEx in 3.0 (in pystone 100000) is because while PyString_CheckExact was swapped out for PyUnicode_CheckExact in LOAD_GLOBAL, ((PyUnicodeObject*)w)->hash always evaluates to -1, which punts us down to the non-inline code. Presumably ((PyStringObject*)w)->ob_shash was already set at this point, which is why it worked in 2.6 and previous.

Before I spend a lot of time trying to track down where this is supposed to be getting set (or, needs to be being set), does anyone know where this is supposed to happen?

-- Nick



More information about the Python-3000 mailing list