[pypy-dev] PyPy's PyDateTime_Delta definition

Skip Montanaro skip at pobox.com
Fri Sep 6 22:15:47 CEST 2013


Python 2.7's PyDateTime_Delta structure is defined like this:

typedef struct
{
    PyObject_HEAD
    long hashcode;              /* -1 when unknown */
    int days;                   /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */
    int seconds;                /* 0 <= seconds < 24*3600 is invariant */
    int microseconds;           /* 0 <= microseconds < 1000000 is invariant */
} PyDateTime_Delta;

In contrast, PyPy's version leaves out everything except
PyObject_HEAD:

typedef struct {
    PyObject_HEAD
} PyDateTime_Delta;

That doesn't seem to be compatible with C extension modules that want
to manipulate such objects.  This is my first foray into trying to
compile some Boost.Python wrappers for libraries at work which
manipulate Python datetime objects. Why are the other four fields not
defined? Is there a way to get around this?


Thx,

Skip


More information about the pypy-dev mailing list