B+tree discussions

Andrew Bennetts andrew at canonical.com
Fri Jul 4 00:35:27 BST 2008


John Arbash Meinel wrote:
[...]
> I wish I could get guppy to compile on win32, but it seems that win32
> doesn't like putting pointers into static structure definitions.  (I'm
> using gcc-mingw, but it really doesn't like:
> PyTypeObject NyBitSet_Type = {
> ~    PyObject_HEAD_INIT(&PyType_Type)
> };

This gotcha is covered in <http://docs.python.org/ext/dnt-basics.html>:

    “... what we'd like to write is:

        PyObject_HEAD_INIT(&PyType_Type)

    as the type of a type object is ``type'', but this isn't strictly conforming
    C and some compilers complain.”

It says you should instead use PyObject_HEAD_INIT(NULL) and rely on
PyType_Ready(...) to fill this in later (typically called during module init).

-Andrew.




More information about the bazaar mailing list