summaryrefslogtreecommitdiff
path: root/psycopg/psycopgmodule.c
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2010-11-19 00:17:24 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2010-11-19 00:28:49 +0000
commit163cf5bfb472e3f1b59b8a8d7a0f9169ec04bc7f (patch)
tree5de4db227c58f90469846d971335dbb437e337ff /psycopg/psycopgmodule.c
parent3e3aa676a9331aee9889f3ad21c75e784f35c31e (diff)
downloadpsycopg2-163cf5bfb472e3f1b59b8a8d7a0f9169ec04bc7f.tar.gz
mx.DateTime module initialized as it is supposed to be.
No need to pass the api pointer around. Dropped compiler warnings.
Diffstat (limited to 'psycopg/psycopgmodule.c')
-rw-r--r--psycopg/psycopgmodule.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c
index 26e17e0..d0a7735 100644
--- a/psycopg/psycopgmodule.c
+++ b/psycopg/psycopgmodule.c
@@ -53,7 +53,7 @@
#ifdef HAVE_MXDATETIME
#include <mxDateTime.h>
#include "psycopg/adapter_mxdatetime.h"
-HIDDEN mxDateTimeModule_APIObject *mxDateTimeP = NULL;
+#include "psycopg/typecast_mxdatetime.h"
#endif
/* some module-level variables, like the datetime module */
@@ -320,9 +320,9 @@ psyco_adapters_init(PyObject *mod)
#ifdef HAVE_MXDATETIME
/* as above, we use the callable objects from the psycopg module */
call = PyMapping_GetItemString(mod, "TimestampFromMx");
- microprotocols_add(mxDateTimeP->DateTime_Type, NULL, call);
+ microprotocols_add(mxDateTime.DateTime_Type, NULL, call);
call = PyMapping_GetItemString(mod, "TimeFromMx");
- microprotocols_add(mxDateTimeP->DateTimeDelta_Type, NULL, call);
+ microprotocols_add(mxDateTime.DateTimeDelta_Type, NULL, call);
#endif
}
@@ -763,7 +763,8 @@ init_psycopg(void)
PyErr_SetString(PyExc_ImportError, "can't import mx.DateTime module");
return;
}
- mxDateTimeP = &mxDateTime;
+ if (psyco_adapter_mxdatetime_init()) { return; }
+ if (psyco_typecast_mxdatetime_init()) { return; }
#endif
/* import python builtin datetime module, if available */