[Cython] To Add datetime.pxd to cython.cpython

ZS szport at gmail.com
Fri Feb 22 08:01:06 CET 2013


Extended part is in datetime_ex.h:

#include "datetime.h"

#define PyDateTime_FromDateAndTimeEx(year, month, day, hour, min, sec,
usec, tzinfo) \
    PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, \
        min, sec, usec, tzinfo, PyDateTimeAPI->DateTimeType)

#define PyTime_FromTimeEx(hour, minute, second, usecond, tzinfo) \
    PyDateTimeAPI->Time_FromTime(hour, minute, second, usecond, \
        tzinfo, PyDateTimeAPI->TimeType)

These macros allow to create dattime/time objects with tzinfo.
Of course we could do:

    t = PyTime_FromTime(........)
    t = t.replace(tzinfo)

in absence of that.


Zaur Shibzukhov


More information about the cython-devel mailing list