[Python-Dev] Call PyType_Ready on builtin types during interpreter startup? (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Sun Dec 21 01:28:25 CET 2008


Aahz wrote:

On Sat, Dec 20, 2008, Nick Coghlan wrote:

It turns out that PyBuiltinInit doesn't call PyTypeReady on any of the builtin types - they're left to have it called implicitly when an operation using them needs tpdict filled in. This seems like a release blocker for 3.0.1 to me

The problem isn't actually as bad as I first thought (it turns out most of the builtin types are fully initialised in _Py_ReadyTypes, which is called from Py_InitializeEx). However, xrange/range are definitely missing from that function (which is the actual proximate cause of the strange range() hashing behaviour in Py3k), and I'm still hoping someone knows why the numeric types aren't being readied there when certain parts of the core need additional handling to cope with the possibility that those types aren't fully initialised (e.g. PyObject_Format has a lazy call to PyType_Ready with a comment noting that it may be asked to format floating point numbers before PyType_Ready has otherwise been called for the float type).

That said, I have still added the range() hashing problem to the list of release blockers.

Cheers, Nick.

-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia



More information about the Python-Dev mailing list