diff options
Diffstat (limited to 'psycopg/psycopgmodule.c')
-rw-r--r-- | psycopg/psycopgmodule.c | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c index acb6781..57c56ee 100644 --- a/psycopg/psycopgmodule.c +++ b/psycopg/psycopgmodule.c @@ -53,11 +53,6 @@ #include "psycopg/adapter_list.h" #include "psycopg/typecast_binary.h" -#ifdef HAVE_MXDATETIME -#include <mxDateTime.h> -#include "psycopg/adapter_mxdatetime.h" -#endif - /* some module-level variables, like the datetime module */ #include <datetime.h> #include "psycopg/adapter_datetime.h" @@ -358,30 +353,6 @@ adapters_init(PyObject *module) if (0 > microprotocols_add(PyDateTimeAPI->DeltaType, NULL, obj)) { goto exit; } Py_CLEAR(obj); -#ifdef HAVE_MXDATETIME - /* As above, we use the callable objects from the psycopg module. - These object are not be available at runtime if mx.DateTime import - failed (e.g. it was available at build time but not at runtime). */ - if (PyMapping_HasKeyString(dict, "TimestampFromMx")) { - if (!(obj = PyMapping_GetItemString(dict, "TimestampFromMx"))) { - goto exit; - } - if (0 > microprotocols_add(mxDateTime.DateTime_Type, NULL, obj)) { - goto exit; - } - Py_CLEAR(obj); - - /* if we found the above, we have this too. */ - if (!(obj = PyMapping_GetItemString(dict, "TimeFromMx"))) { - goto exit; - } - if (0 > microprotocols_add(mxDateTime.DateTimeDelta_Type, NULL, obj)) { - goto exit; - } - Py_CLEAR(obj); - } -#endif - /* Success! */ rv = 0; @@ -943,34 +914,6 @@ datetime_init(void) return 0; } -RAISES_NEG static int -mxdatetime_init(PyObject *module) -{ - Dprintf("psycopgmodule: initializing mx.DateTime module"); - -#ifdef HAVE_MXDATETIME - Py_SET_TYPE(&mxdatetimeType, &PyType_Type); - if (0 > PyType_Ready(&mxdatetimeType)) { return -1; } - - if (mxDateTime_ImportModuleAndAPI()) { - Dprintf("psycopgmodule: mx.DateTime module import failed"); - PyErr_Clear(); - } - - /* If we can't find mx.DateTime objects at runtime, - * remove them from the module (and, as consequence, from the adapters). */ - if (0 != psyco_adapter_mxdatetime_init()) { - PyObject *dict; - if (!(dict = PyModule_GetDict(module))) { return -1; } - if (0 > PyDict_DelItemString(dict, "DateFromMx")) { return -1; } - if (0 > PyDict_DelItemString(dict, "TimeFromMx")) { return -1; } - if (0 > PyDict_DelItemString(dict, "TimestampFromMx")) { return -1; } - if (0 > PyDict_DelItemString(dict, "IntervalFromMx")) { return -1; } - } -#endif - return 0; -} - /** method table and module initialization **/ static PyMethodDef psycopgMethods[] = { @@ -1014,18 +957,6 @@ static PyMethodDef psycopgMethods[] = { {"IntervalFromPy", (PyCFunction)psyco_IntervalFromPy, METH_VARARGS, psyco_IntervalFromPy_doc}, -#ifdef HAVE_MXDATETIME - /* to be deleted if not found at import time */ - {"DateFromMx", (PyCFunction)psyco_DateFromMx, - METH_VARARGS, psyco_DateFromMx_doc}, - {"TimeFromMx", (PyCFunction)psyco_TimeFromMx, - METH_VARARGS, psyco_TimeFromMx_doc}, - {"TimestampFromMx", (PyCFunction)psyco_TimestampFromMx, - METH_VARARGS, psyco_TimestampFromMx_doc}, - {"IntervalFromMx", (PyCFunction)psyco_IntervalFromMx, - METH_VARARGS, psyco_IntervalFromMx_doc}, -#endif - {"set_wait_callback", (PyCFunction)psyco_set_wait_callback, METH_O, psyco_set_wait_callback_doc}, {"get_wait_callback", (PyCFunction)psyco_get_wait_callback, @@ -1086,7 +1017,6 @@ INIT_MODULE(_psycopg)(void) if (0 > add_module_constants(module)) { goto exit; } if (0 > add_module_types(module)) { goto exit; } if (0 > datetime_init()) { goto exit; } - if (0 > mxdatetime_init(module)) { goto exit; } if (0 > encodings_init(module)) { goto exit; } if (0 > typecast_init(module)) { goto exit; } if (0 > adapters_init(module)) { goto exit; } |