Add function `import_datetime`
authorZaur Shibzukhov <szport@gmail.com>
Sun, 3 Mar 2013 13:38:11 +0000 (16:38 +0300)
committerZaur Shibzukhov <szport@gmail.com>
Sun, 3 Mar 2013 13:38:11 +0000 (16:38 +0300)
Add inline function `import_datetime` for initialization of PyDateTime C API.

Cython/Includes/cpython/datetime.pxd

index 60939dd..9ec1ee8 100644 (file)
@@ -97,11 +97,13 @@ cdef extern from "datetime.h":
     # PyDateTime CAPI object.
     PyDateTime_CAPI *PyDateTimeAPI
     
-    # Datetime C API object initialization C macros.
-    # You have to call this before any usage of DateTime CAPI functions:
-    #   PyDateTime_IMPORT
     void PyDateTime_IMPORT()
 
+# Datetime C API initialization function.
+# You have to call it before any usage of DateTime CAPI functions.
+cdef inline import_datetime():
+    PyDateTime_IMPORT
+
 # Create date object using DateTime CAPI factory function.
 # Note, there are no range checks for any of the arguments.
 cdef inline object date_new(int year, int month, int day):