From 4339f97ca33a5379927ec7c5b07f50114e07e813 Mon Sep 17 00:00:00 2001 From: Tomas Mlcoch Date: Tue, 12 Aug 2014 09:24:11 +0200 Subject: [PATCH] Python: Fix imports of datetime.h and call PyDateTime_IMPORT during module init. --- src/python/createrepo_cmodule.c | 5 +++++ src/python/updaterecord-py.c | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/python/createrepo_cmodule.c b/src/python/createrepo_cmodule.c index 9489b11..a392784 100644 --- a/src/python/createrepo_cmodule.c +++ b/src/python/createrepo_cmodule.c @@ -18,6 +18,7 @@ */ #include +#include // from python #include "src/createrepo_c.h" @@ -192,6 +193,10 @@ init_createrepo_c(void) Py_AtExit(cr_xml_dump_cleanup); Py_AtExit(cr_package_parser_cleanup); + /* Python macro to use datetime objects */ + + PyDateTime_IMPORT; + /* Module constants */ /* Version */ diff --git a/src/python/updaterecord-py.c b/src/python/updaterecord-py.c index 2f344e0..8ed4129 100644 --- a/src/python/updaterecord-py.c +++ b/src/python/updaterecord-py.c @@ -18,7 +18,7 @@ */ #include -#include +#include // from python #include #include #include @@ -79,9 +79,6 @@ check_UpdateRecordStatus(const _UpdateRecordObject *self) static PyObject * updaterecord_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - /* Python macro to use datetime objects */ - PyDateTime_IMPORT; - CR_UNUSED(args); CR_UNUSED(kwds); _UpdateRecordObject *self = (_UpdateRecordObject *)type->tp_alloc(type, 0); -- 2.7.4