[Python-Dev] mingw32 and gc-header weirdness

Antoine Pitrou solipsis at pitrou.net
Thu Jul 23 23:38:47 CEST 2009


Antoine Pitrou <solipsis <at> pitrou.net> writes:
> 
> In any case, you seem to be right on this particular point: the PyGC_Head union
> should probably contain a "double" alternative in addition to the "long double"
> (and perhaps even a "long long" one).

Sorry, I realize that this doesn't really address the point.
In addition to that union, we should also have a particular mechanism to compute
what the proper offset should be between the PyGC_Head and the PyObject.
Probably something like:

typedef struct {
    PyGC_Head head;
    union {
      /* ... similar union as in PyGC_head */
    } body;
} _PyGC_dummy;

#define _PyGC_Head_OFFSET offsetof(_PyGC_dummy, body)
#define _Py_AS_GC(o) ((PyGC_Head *) ((void *)(o) - _PyGC_Head_OFFSET))

Regards

Antoine.





More information about the Python-Dev mailing list