Hi Skip, hi Amaury, On Sat, Sep 7, 2013 at 3:16 AM, Skip Montanaro <s...@pobox.com> wrote: > Alas, I am still confused. The PyDateTime_DELTA_GET_* macros aren't > defined for CPython until the 3.x series. (There are macros in 2.7, > but they are defined in datetimemodule.c, not in a public header file. > PyPy declares them as functions.
Uh, yes, I'd like to ask this question too. In Python 2.7's Include/datetime.h I see the struct PyDateTime_Delta (which is public) and no macro PyDateTime_DELTA_*. There are macros PyDateTime_TIME_GET_* and PyDateTime_DATE_GET_* as well as some PyDateTime_GET_* for both date and datetime instances, which are declared as structs with a non-public name. (Why? No clue) It seems that "struct PyDateTime_Delta" is supposed to be purely read-only. In case situation, wouldn't it make sense to expose a structure with a similar layout? I don't think we care about the overhead of copying three words; the only annoying case is about read-write objects, when we want the changes in C to be reflected back to the Python world. > Is there some predefined "This is PyPy" macro I can check? In this case, as a workaround, you can check "#ifndef PyDateTime_DELTA_GET_..." and declare them yourself. A bientôt, Armin. _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev