Index: datetimemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v retrieving revision 1.71 diff --unified -r1.71 datetimemodule.c --- datetimemodule.c 21 Mar 2004 23:38:41 -0000 1.71 +++ datetimemodule.c 26 May 2004 15:27:49 -0000 @@ -8,7 +8,12 @@ #include +/* force a differentiation between building the core module and building + * extension modules + */ +#define Py_BUILD_CORE #include "datetime.h" +#undef Py_BUILD_CORE /* We require that C int be at least 32 bits, and use int virtually * everywhere. In just a few cases we use a temp long, where a Python @@ -4513,6 +4518,22 @@ {NULL, NULL} }; + +static PyDateTime_CAPI CAPI = { + &PyDateTime_DateType, + &PyDateTime_DateTimeType, + &PyDateTime_TimeType, + &PyDateTime_DeltaType, + &PyDateTime_TZInfoType, + new_date_ex, + new_datetime_ex, + new_time_ex, + new_delta_ex, + datetime_fromtimestamp, + date_fromtimestamp +}; + + PyMODINIT_FUNC initdatetime(void) { @@ -4626,6 +4647,12 @@ Py_INCREF(&PyDateTime_TZInfoType); PyModule_AddObject(m, "tzinfo", (PyObject *) &PyDateTime_TZInfoType); + x = PyCObject_FromVoidPtrAndDesc(&CAPI, (void*) DATETIME_API_MAGIC, + NULL); + if (x == NULL) + return; + PyModule_AddObject(m, "datetime_CAPI", x); + /* A 4-year cycle has an extra leap day over what we'd get from * pasting together 4 single years. */