I just got burned (wasted a good day or so) by the fact that PyDateTimeAPI wasn't initialized. The datetime.rst doc states (emphasis mine):

Before using any of these functions, the header file :file:`datetime.h` must be included in your source (note that this is not included by :file:`Python.h`), and the macro :c:macro:`PyDateTime_IMPORT` must be invoked, usually as part of the module initialisation function.

I thought that surely the datetime module itself would initialize that stuff. Why not? Is it so terribly expensive that the C API requires this rather weird hack? The code's been their for ages, so there must have been a good reason at one time. Is that reason still valid today? (I haven't programmed at the C API level for a good long while, or I'm sure I'd have encountered this before.)

Thx,

Skip