[Numpy-svn] r8098 - in branches/1.4.x/numpy/core: . code_generators include/numpy src/multiarray src/umath tests

numpy-svn at scipy.org numpy-svn at scipy.org
Tue Feb 9 01:11:19 EST 2010


Author: cdavid
Date: 2010-02-09 00:11:19 -0600 (Tue, 09 Feb 2010)
New Revision: 8098

Removed:
   branches/1.4.x/numpy/core/src/multiarray/datetime.c
   branches/1.4.x/numpy/core/tests/test_datetime.py
Modified:
   branches/1.4.x/numpy/core/SConscript
   branches/1.4.x/numpy/core/code_generators/genapi.py
   branches/1.4.x/numpy/core/code_generators/generate_umath.py
   branches/1.4.x/numpy/core/include/numpy/arrayscalars.h
   branches/1.4.x/numpy/core/include/numpy/ndarrayobject.h
   branches/1.4.x/numpy/core/setup.py
   branches/1.4.x/numpy/core/src/multiarray/arraytypes.c.src
   branches/1.4.x/numpy/core/src/multiarray/convert_datatype.c
   branches/1.4.x/numpy/core/src/multiarray/descriptor.c
   branches/1.4.x/numpy/core/src/multiarray/multiarraymodule.c
   branches/1.4.x/numpy/core/src/multiarray/scalarapi.c
   branches/1.4.x/numpy/core/src/multiarray/scalartypes.c.src
   branches/1.4.x/numpy/core/src/multiarray/scalartypes.h
   branches/1.4.x/numpy/core/src/umath/loops.h
   branches/1.4.x/numpy/core/src/umath/loops.h.src
   branches/1.4.x/numpy/core/src/umath/ufunc_object.c
Log:
REF: remove datetime support at the C level.

Modified: branches/1.4.x/numpy/core/SConscript
===================================================================
--- branches/1.4.x/numpy/core/SConscript	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/SConscript	2010-02-09 06:11:19 UTC (rev 8098)
@@ -427,7 +427,6 @@
     multiarray_src = [pjoin('src', 'multiarray', 'multiarraymodule.c'),
         pjoin('src', 'multiarray', 'hashdescr.c'),
         pjoin('src', 'multiarray', 'arrayobject.c'),
-        pjoin('src', 'multiarray', 'datetime.c'),
         pjoin('src', 'multiarray', 'numpyos.c'),
         pjoin('src', 'multiarray', 'flagsobject.c'),
         pjoin('src', 'multiarray', 'descriptor.c'),

Modified: branches/1.4.x/numpy/core/code_generators/genapi.py
===================================================================
--- branches/1.4.x/numpy/core/code_generators/genapi.py	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/code_generators/genapi.py	2010-02-09 06:11:19 UTC (rev 8098)
@@ -44,7 +44,6 @@
              join('multiarray', 'refcount.c'),
              join('multiarray', 'conversion_utils.c'),
              join('multiarray', 'buffer.c'),
-             join('multiarray', 'datetime.c'),
              join('umath', 'ufunc_object.c'),
              join('umath', 'loops.c.src'),
             ]

Modified: branches/1.4.x/numpy/core/code_generators/generate_umath.py
===================================================================
--- branches/1.4.x/numpy/core/code_generators/generate_umath.py	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/code_generators/generate_umath.py	2010-02-09 06:11:19 UTC (rev 8098)
@@ -168,19 +168,16 @@
               'F': 'cfloat',
               'D': 'cdouble',
               'G': 'clongdouble',
-              'M': 'datetime',
-              'm': 'timedelta',
               'O': 'OBJECT',
               # '.' is like 'O', but calls a method of the object instead
               # of a function
               'P': 'OBJECT',
               }
 
-all = '?bBhHiIlLqQfdgFDGOMm'
+all = '?bBhHiIlLqQfdgFDGO'
 O = 'O'
 P = 'P'
 ints = 'bBhHiIlLqQ'
-times = 'Mm'
 intsO = ints + O
 bints = '?' + ints
 bintsO = bints + O
@@ -193,13 +190,13 @@
 inexact = flts + cmplx
 noint = inexact+O
 nointP = inexact+P
-allP = bints+times+flts+cmplxP
+allP = bints+flts+cmplxP
 nobool = all[1:]
-noobj = all[:-3]+all[-2:]
-nobool_or_obj = all[1:-3]+all[-2:]
+noobj = all[:-2]
+nobool_or_obj = all[1:-2]
 intflt = ints+flts
 intfltcmplx = ints+flts+cmplx
-nocmplx = bints+times+flts
+nocmplx = bints+flts
 nocmplxO = nocmplx+O
 nocmplxP = nocmplx+P
 notimes_or_obj = bints + inexact
@@ -218,20 +215,20 @@
     Ufunc(2, 1, Zero,
           docstrings.get('numpy.core.umath.add'),
           TD(notimes_or_obj),
-          [TypeDescription('M', UsesArraysAsData, 'Mm', 'M'),
-           TypeDescription('m', UsesArraysAsData, 'mm', 'm'),
-           TypeDescription('M', UsesArraysAsData, 'mM', 'M'),
-          ],
+          #[TypeDescription('M', UsesArraysAsData, 'Mm', 'M'),
+          # TypeDescription('m', UsesArraysAsData, 'mm', 'm'),
+          # TypeDescription('M', UsesArraysAsData, 'mM', 'M'),
+          #],
           TD(O, f='PyNumber_Add'),
           ),
 'subtract' :
     Ufunc(2, 1, Zero,
           docstrings.get('numpy.core.umath.subtract'),
           TD(notimes_or_obj),
-          [TypeDescription('M', UsesArraysAsData, 'Mm', 'M'),
-           TypeDescription('m', UsesArraysAsData, 'mm', 'm'),
-           TypeDescription('M', UsesArraysAsData, 'MM', 'm'),
-          ],
+          #[TypeDescription('M', UsesArraysAsData, 'Mm', 'M'),
+          # TypeDescription('m', UsesArraysAsData, 'mm', 'm'),
+          # TypeDescription('M', UsesArraysAsData, 'MM', 'm'),
+          #],
           TD(O, f='PyNumber_Subtract'),
           ),
 'multiply' :

Modified: branches/1.4.x/numpy/core/include/numpy/arrayscalars.h
===================================================================
--- branches/1.4.x/numpy/core/include/numpy/arrayscalars.h	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/include/numpy/arrayscalars.h	2010-02-09 06:11:19 UTC (rev 8098)
@@ -112,19 +112,6 @@
 
 typedef struct {
         PyObject_HEAD
-        npy_datetime obval;
-        PyArray_DatetimeMetaData obmeta;
-} PyDatetimeScalarObject;
-
-typedef struct {
-        PyObject_HEAD
-        npy_timedelta obval;
-        PyArray_DatetimeMetaData obmeta;
-} PyTimedeltaScalarObject;
-
-
-typedef struct {
-        PyObject_HEAD
         char obval;
 } PyScalarObject;
 

Modified: branches/1.4.x/numpy/core/include/numpy/ndarrayobject.h
===================================================================
--- branches/1.4.x/numpy/core/include/numpy/ndarrayobject.h	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/include/numpy/ndarrayobject.h	2010-02-09 06:11:19 UTC (rev 8098)
@@ -78,7 +78,6 @@
                     NPY_OBJECT=17,
                     NPY_STRING, NPY_UNICODE,
                     NPY_VOID,
-                    NPY_DATETIME, NPY_TIMEDELTA,
                     NPY_NTYPES,
                     NPY_NOTYPE,
                     NPY_CHAR,      /* special flag */
@@ -574,25 +573,6 @@
         int flags;
 } PyArray_Chunk;
 
-
-typedef struct {
-        NPY_DATETIMEUNIT base;
-        int num;
-        int den;      /* Converted to 1 on input for now -- an input-only mechanism */
-        int events;
-} PyArray_DatetimeMetaData;
-
-typedef struct {
-        npy_longlong year;
-        int month, day, hour, min, sec, us, ps, as;
-} npy_datetimestruct;
-
-typedef struct {
-        npy_longlong day;
-        int sec, us, ps, as;
-} npy_timedeltastruct;
-
-
 #define PyDataType_GetDatetimeMetaData(descr) ((descr->metadata == NULL) ? NULL : ((PyArray_DatetimeMetaData *)(PyCObject_AsVoidPtr(PyDict_GetItemString(descr->metadata, NPY_METADATA_DTSTR)))))
 
 typedef int (PyArray_FinalizeFunc)(PyArrayObject *, PyObject *);

Modified: branches/1.4.x/numpy/core/setup.py
===================================================================
--- branches/1.4.x/numpy/core/setup.py	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/setup.py	2010-02-09 06:11:19 UTC (rev 8098)
@@ -703,7 +703,6 @@
         join('src', 'multiarray', 'hashdescr.c'),
         join('src', 'multiarray', 'arrayobject.c'),
         join('src', 'multiarray', 'buffer.c'),
-        join('src', 'multiarray', 'datetime.c'),
         join('src', 'multiarray', 'numpyos.c'),
         join('src', 'multiarray', 'conversion_utils.c'),
         join('src', 'multiarray', 'flagsobject.c'),

Modified: branches/1.4.x/numpy/core/src/multiarray/arraytypes.c.src
===================================================================
--- branches/1.4.x/numpy/core/src/multiarray/arraytypes.c.src	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/src/multiarray/arraytypes.c.src	2010-02-09 06:11:19 UTC (rev 8098)
@@ -1,7 +1,6 @@
 /* -*- c -*- */
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
-#include "datetime.h"
 #include "structmember.h"
 
 #define _MULTIARRAYMODULE
@@ -16,7 +15,6 @@
 #include "ctors.h"
 #include "usertypes.h"
 #include "npy_config.h"
-#include "_datetime.h"
 #include "scalartypes.h"
 
 #include "numpyos.h"
@@ -705,458 +703,6 @@
 }
 
 /*
- * Acknowledgment:  Example code contributed by Marty Fuhr sponsored by
- * Google Summer of Code 2009 was used to integrate and adapt the mxDateTime
- * parser
- */
-
-/* #include "datetime.c" --- now included in multiarray_onefile */
-
-
-/* DateTime Objects in Python only keep microsecond resolution.
- *
- * When converting from datetime objects with an event component return a
- * tuple: * (baseunit, number of event)  where baseunit follows is a datetime
- * type and number of events is a Python integer
- */
-
-
-/*
- * Return a Python Datetime Object from a number representing the number of
- * units since the epoch (1970-01-01T00:00:00Z) ignoring leap seconds.
- */
-
-NPY_NO_EXPORT PyObject *
-PyDateTime_FromNormalized(npy_datetime val, NPY_DATETIMEUNIT base)
-{
-    npy_datetimestruct ydate;
-
-    /* Must be here to use PyDateTime_FromDateAndTime */
-    PyDateTime_IMPORT;
-
-    /* We just truncate the unused variables and don't wory about overflow */
-    PyArray_DatetimeToDatetimeStruct(val, base, &ydate);
-
-    /* FIXME?: We discard ydate.ns, ydate.ps, ydate.fs, and ydate.as */
-    return PyDateTime_FromDateAndTime(ydate.year, ydate.month, ydate.day,
-                                      ydate.hour, ydate.min, ydate.sec,
-                                      ydate.us);
-}
-
-/*
- * We also can lose precision and range here.  Ignored.
- * Don't use this function if you care.
- */
-
-NPY_NO_EXPORT PyObject *
-PyTimeDelta_FromNormalized(npy_timedelta val, NPY_DATETIMEUNIT base)
-{
-    npy_timedeltastruct td;
-
-    PyDateTime_IMPORT;
-    PyArray_TimedeltaToTimedeltaStruct(val, base, &td);
-
-    /* We discard td.ps and td.as */
-    return PyDelta_FromDSU(td.day, td.sec, td.us);
-}
-
-
-NPY_NO_EXPORT PyObject *
-PyDateTime_FromInt64(datetime val, PyArray_Descr *descr)
-{
-    PyArray_DatetimeMetaData *meta;
-
-    meta = PyDataType_GetDatetimeMetaData(descr);
-    if (meta == NULL) {
-        PyErr_SetString(PyExc_RuntimeError,
-                "metadata not set for descriptor");
-        return NULL;
-    }
-
-    if (meta->events > 1) {
-        int events, rem, div;
-        PyObject *obj;
-
-        obj = PyTuple_New(2);
-        events = meta->events;
-        div = val/events;
-        rem = val % events;
-        PyTuple_SET_ITEM(obj, 1, PyInt_FromLong(rem));
-        /* This resets meta->events for recursive call */
-        meta->events = 1;
-        PyTuple_SET_ITEM(obj, 0, PyDateTime_FromInt64(div, descr));
-        meta->events = events;
-        if (PyErr_Occurred()) {
-            Py_DECREF(obj);
-            return NULL;
-        }
-        return obj;
-    }
-
-    /*
-     * We normalize the number to a base-unit and then return a
-     * Python Datetime Object
-     *
-     * FIXME? : We silently truncate if it doesn't fit, either too
-     *  wide (e.g. 10 BC) or too narrow (nanoseconds)
-     */
-
-    /* Normalization and then conversion to Datetime */
-    /* FIXME? : Check for Overflow... */
-    return PyDateTime_FromNormalized(val*meta->num, meta->base);
-}
-
-
-NPY_NO_EXPORT PyObject *
-PyTimeDelta_FromInt64(timedelta val, PyArray_Descr *descr)
-{
-    PyArray_DatetimeMetaData *meta;
-    meta = PyDataType_GetDatetimeMetaData(descr);
-    if (meta == NULL) {
-        PyErr_SetString(PyExc_RuntimeError,
-                "metadata not set for descriptor");
-        return NULL;
-    }
-
-    if (meta->events > 1) {
-        int events, rem, div;
-        PyObject *obj;
-
-        obj = PyTuple_New(2);
-        events = meta->events;
-        div = val/events;
-        rem = val % events;
-        PyTuple_SET_ITEM(obj, 1, PyInt_FromLong(rem));
-        /* This resets meta->events for recursive call */
-        meta->events = 1;
-        PyTuple_SET_ITEM(obj, 0, PyTimeDelta_FromInt64(div, descr));
-        meta->events = events;
-        if (PyErr_Occurred()) {
-            Py_DECREF(obj);
-            return NULL;
-        }
-        return obj;
-    }
-
-    /* FIXME? : Check for Overflow */
-    return PyTimeDelta_FromNormalized(val*meta->num, meta->base);
-}
-
-
-
-NPY_NO_EXPORT npy_datetime
-PyDateTime_AsNormalized(PyObject *obj, NPY_DATETIMEUNIT base)
-{
-    npy_datetimestruct ydate;
-
-    /* Must be here to use PyDateTime_FromDateAndTime */
-    PyDateTime_IMPORT;
-
-    if (!PyDateTime_Check(obj) && !PyDate_Check(obj)) {
-        PyErr_SetString(PyExc_ValueError,
-                "Must be a datetime.date or datetime.datetime object");
-        return -1;
-    }
-
-    ydate.year = PyDateTime_GET_YEAR(obj);
-    ydate.month = PyDateTime_GET_MONTH(obj);
-    ydate.day = PyDateTime_GET_DAY(obj);
-
-    if (PyDateTime_Check(obj)) {
-        ydate.hour = PyDateTime_DATE_GET_HOUR(obj);
-        ydate.min = PyDateTime_DATE_GET_MINUTE(obj);
-        ydate.sec = PyDateTime_DATE_GET_SECOND(obj);
-        ydate.us = PyDateTime_DATE_GET_MICROSECOND(obj);
-    }
-    else {
-        ydate.hour = 0;
-        ydate.min = 0;
-        ydate.sec = 0;
-        ydate.us = 0;
-    }
-
-    ydate.ps = 0;
-    ydate.as = 0;
-
-    /* We just truncate the unused variables and don't wory about overflow */
-    return PyArray_DatetimeStructToDatetime(base, &ydate);
-}
-
-NPY_NO_EXPORT npy_timedelta
-PyTimeDelta_AsNormalized(PyObject *obj, NPY_DATETIMEUNIT base)
-{
-    npy_timedeltastruct td;
-
-    PyDateTime_IMPORT;
-
-    if (!PyDelta_Check(obj)) {
-        PyErr_SetString(PyExc_ValueError,
-                "Must be a datetime.timedelta object");
-        return -1;
-    }
-
-    td.day = ((PyDateTime_Delta *)obj)->days;
-    td.sec = ((PyDateTime_Delta *)obj)->seconds;
-    td.us  = ((PyDateTime_Delta *)obj)->microseconds;
-    td.ps  = 0;
-    td.as  = 0;
-
-    return PyArray_TimedeltaStructToTimedelta(base, &td);
-}
-
-
-/*
- * These expect a 2-tuple if meta->events > 1  (baseobj, num-counts)
- * where baseobj is a datetime object or a timedelta object respectively.
- *
- */
-
-NPY_NO_EXPORT npy_datetime
-PyDateTime_AsInt64(PyObject *obj, PyArray_Descr *descr)
-{
-    PyArray_DatetimeMetaData *meta;
-    npy_datetime res;
-
-    meta = PyDataType_GetDatetimeMetaData(descr);
-    if (meta == NULL) {
-        PyErr_SetString(PyExc_RuntimeError,
-                "metadata not set for descriptor");
-        return -1;
-    }
-
-
-    if (meta->events > 1) {
-        datetime tmp;
-        int events;
-
-        if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 2) {
-            PyErr_SetString(PyExc_ValueError,
-                    "need a 2-tuple on setting if events > 1");
-            return -1;
-        }
-        /* Alter the dictionary and call again */
-        /* FIXME:  not thread safe */
-        events = meta->events;
-        meta->events = 1;
-        tmp = PyDateTime_AsInt64(PyTuple_GET_ITEM(obj, 0), descr);
-        meta->events = events;
-        if (PyErr_Occurred()) {
-            return -1;
-        }
-        /* FIXME: Check for overflow */
-        tmp *= events;
-        tmp += MyPyLong_AsLongLong(PyTuple_GET_ITEM(obj, 1));
-        if (PyErr_Occurred()) {
-            return -1;
-        }
-        return tmp;
-    }
-
-    res = PyDateTime_AsNormalized(obj, meta->base);
-    return res/meta->num;
-}
-
-
-NPY_NO_EXPORT timedelta
-PyTimeDelta_AsInt64(PyObject *obj, PyArray_Descr *descr)
-{
-    PyArray_DatetimeMetaData *meta;
-    npy_timedelta res;
-
-    meta = PyDataType_GetDatetimeMetaData(descr);
-    if (meta == NULL) {
-        PyErr_SetString(PyExc_RuntimeError,
-                "metadata not set for descriptor");
-        return -1;
-    }
-
-    if (meta->events > 1) {
-        timedelta tmp;
-        int events;
-
-        if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 2) {
-            PyErr_SetString(PyExc_ValueError,
-                    "need a 2-tuple on setting if events > 1");
-            return -1;
-        }
-        /* Alter the dictionary and call again (not thread safe) */
-        events = meta->events;
-        meta->events = 1;
-        tmp = PyTimeDelta_AsInt64(PyTuple_GET_ITEM(obj, 0), descr);
-        meta->events = events;
-        if (PyErr_Occurred()) {
-            return -1;
-        }
-        /* FIXME: Check for overflow */
-        tmp *= events;
-        tmp += MyPyLong_AsLongLong(PyTuple_GET_ITEM(obj, 1));
-        if (PyErr_Occurred()) {
-            return -1;
-        }
-        return tmp;
-    }
-
-    res = PyTimeDelta_AsNormalized(obj, meta->base);
-    return res / meta->num;
-}
-
-
-/*
- * Always return DateTime Object after normalizing to basic units (or a tuple
- * if meta->events > 1):
- *
- *  Problem:  DateTime does not support all the resolutions (ns) nor the
- *  dynamic range (pre 1 AD) of NumPy Date-times.
- *
- * getitem is not used that much --- if losing resolution hurts, stick
- * with the array scalar versions of the date-time.
- *
- * considered returning array scalars here just like longdouble. This has the
- * problem of recursion in some cases (because in a few places the code
- * expects getitem to return a Python-system object)
- *
- * considered returning different things depending on the resolution but this
- * would make it hard to write generic code  --- but do you need to write
- * generic code on all the frequencies because they cover a wide range.
- *
- * Solution:  The use-case of actually wanting a date-time object when the
- * resolution and dynamic range match, make it the compelling default. When it
- * does fails, there are alternatives for the programmer to use.
- *
- * New question: Should we change (c)longdouble at this point? to return Python Float?
- */
-
-static PyObject *
-DATETIME_getitem(char *ip, PyArrayObject *ap) {
-    datetime t1;
-
-    if ((ap == NULL) || PyArray_ISBEHAVED_RO(ap)) {
-        t1 = *((datetime *)ip);
-        return PyDateTime_FromInt64((datetime)t1, ap->descr);
-    }
-    else {
-        ap->descr->f->copyswap(&t1, ip, !PyArray_ISNOTSWAPPED(ap), ap);
-        return PyDateTime_FromInt64((datetime)t1, ap->descr);
-    }
-}
-
-static PyObject *
-TIMEDELTA_getitem(char *ip, PyArrayObject *ap) {
-    timedelta t1;
-
-    if ((ap == NULL) || PyArray_ISBEHAVED_RO(ap)) {
-        t1 = *((timedelta *)ip);
-        return PyTimeDelta_FromInt64((timedelta)t1, ap->descr);
-    }
-    else {
-        ap->descr->f->copyswap(&t1, ip, !PyArray_ISNOTSWAPPED(ap), ap);
-        return PyTimeDelta_FromInt64((timedelta)t1, ap->descr);
-    }
-}
-
-/* FIXME:
- *  This needs to take
- *      1) Integers and Longs (anything that can be converted to an Int)
- *      2) Strings (ISO-style dates)
- *      3) Datetime Scalars (that it converts based on scalar dtype.
- *      4) Datetime and Date objects
- *  Plus a tuple for meta->events > 1
- *
- *      3) is partially implemented, 4) is implemented
- */
-
-static int
-DATETIME_setitem(PyObject *op, char *ov, PyArrayObject *ap) {
-    /* ensure alignment */
-    datetime temp;
-
-    if (PyArray_IsScalar(op, Datetime)) {
-        /* This needs to convert based on type */
-        temp = ((PyDatetimeScalarObject *)op)->obval;
-    }
-    else if (PyString_Check(op) || PyUnicode_Check(op)) {
-        /* FIXME:  Converts to DateTime first and therefore does not handle extended notation */
-        /* import _mx_datetime_parser 
-         * res = _mx_datetime_parser(name)
-         *  Convert from datetime to Int
-         */
-        PyObject *res, *module;
-
-        module = PyImport_ImportModule("numpy.core._mx_datetime_parser");
-        if (module == NULL) { return -1; }
-        res = PyObject_CallMethod(module, "datetime_from_string", "O", op);
-        Py_DECREF(module);
-        if (res == NULL) { return -1; }
-        temp = PyDateTime_AsInt64(res, ap->descr);
-        Py_DECREF(res);
-        if (PyErr_Occurred()) return -1;
-    }
-    else if (PyInt_Check(op)) {
-        temp = PyInt_AS_LONG(op);
-    }
-    else if (PyLong_Check(op)) {
-        temp = PyLong_AsLongLong(op);
-    }
-    else {
-        temp = PyDateTime_AsInt64(op, ap->descr);
-    }
-    if (PyErr_Occurred()) {
-        if (PySequence_Check(op)) {
-            PyErr_Clear();
-            PyErr_SetString(PyExc_ValueError, _SEQUENCE_MESSAGE);
-        }
-        return -1;
-    }
-    if (ap == NULL || PyArray_ISBEHAVED(ap))
-        *((datetime *)ov)=temp;
-    else {
-        ap->descr->f->copyswap(ov, &temp, !PyArray_ISNOTSWAPPED(ap), ap);
-    }
-    return 0;
-}
-
-/* FIXME: This needs to take
- *    1) Integers and Longs (anything that can be converted to an Int)
- *    2) Timedelta scalar objects (with resolution conversion)
- *    3) Python Timedelta objects
- *
- *    Plus a tuple for meta->events > 1
- */
-
-static int
-TIMEDELTA_setitem(PyObject *op, char *ov, PyArrayObject *ap) {
-    /* ensure alignment */
-    timedelta temp;
-
-    if (PyArray_IsScalar(op, Timedelta)) {
-        temp = ((PyTimedeltaScalarObject *)op)->obval;
-    }
-    else if (PyInt_Check(op)) {
-        temp = PyInt_AS_LONG(op);
-    }
-    else if (PyLong_Check(op)) {
-        temp = PyLong_AsLongLong(op);
-    }
-    else {
-        temp = PyTimeDelta_AsInt64(op, ap->descr);
-    }
-    if (PyErr_Occurred()) {
-        if (PySequence_Check(op)) {
-            PyErr_Clear();
-            PyErr_SetString(PyExc_ValueError, _SEQUENCE_MESSAGE);
-        }
-        return -1;
-    }
-    if (ap == NULL || PyArray_ISBEHAVED(ap))
-        *((timedelta *)ov)=temp;
-    else {
-        ap->descr->f->copyswap(ov, &temp, !PyArray_ISNOTSWAPPED(ap), ap);
-    }
-    return 0;
-}
-
-
-/*
  *****************************************************************************
  **                       TYPE TO TYPE CONVERSIONS                          **
  *****************************************************************************
@@ -1169,21 +715,17 @@
 /**begin repeat
  *
  * #TOTYPE = BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,
- *           LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME,
- *           TIMEDELTA#
+ *           LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE#
  * #totype = byte, ubyte, short, ushort, int, uint, long, ulong,
- *           longlong, ulonglong, float, double, longdouble, datetime,
- *           timedelta#
+ *           longlong, ulonglong, float, double, longdouble#
 */
 
 /**begin repeat1
  *
  * #FROMTYPE = BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,
- *             LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME,
- *             TIMEDELTA#
+ *             LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE#
  * #fromtype = byte, ubyte, short, ushort, int, uint, long, ulong,
- *             longlong, ulonglong, float, double, longdouble, datetime,
- *             timedelta#
+ *             longlong, ulonglong, float, double, longdouble#
  */
 static void
 @FROMTYPE at _to_@TOTYPE@(@fromtype@ *ip, @totype@ *op, intp n,
@@ -1217,11 +759,9 @@
 /**begin repeat
  *
  * #FROMTYPE = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,
- *             LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME,
- *             TIMEDELTA#
+ *             LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE#
  * #fromtype = Bool, byte, ubyte, short, ushort, int, uint, long, ulong,
- *             longlong, ulonglong, float, double, longdouble, datetime,
- *             timedelta#
+ *             longlong, ulonglong, float, double, longdouble#
 */
 static void
 @FROMTYPE at _to_BOOL(@fromtype@ *ip, Bool *op, intp n,
@@ -1252,11 +792,9 @@
 
 /**begin repeat
  * #TOTYPE = BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,
- *           LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME,
- *           TIMEDELTA#
+ *           LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE#
  * #totype = byte, ubyte, short, ushort, int, uint, long, ulong,
- *           longlong, ulonglong, float, double, longdouble, datetime,
- *           timedelta#
+ *           longlong, ulonglong, float, double, longdouble#
 */
 static void
 BOOL_to_ at TOTYPE@(Bool *ip, @totype@ *op, intp n,
@@ -1276,11 +814,9 @@
 
 /**begin repeat1
  * #FROMTYPE = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,
- *             LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME,
- *             TIMEDELTA#
+ *             LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE#
  * #fromtype = Bool, byte, ubyte, short, ushort, int, uint, long, ulong,
- *             longlong, ulonglong, float, double, longdouble, datetime,
- *             timedelta#
+ *             longlong, ulonglong, float, double, longdouble#
  */
 static void
 @FROMTYPE at _to_@TOTYPE@(@fromtype@ *ip, @totype@ *op, intp n,
@@ -1322,13 +858,11 @@
  *
  * #FROMTYPE = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,
  *             LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE,
- *             CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, VOID, OBJECT,
- *             DATETIME, TIMEDELTA#
+ *             CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, VOID, OBJECT#
  * #fromtype = Bool, byte, ubyte, short, ushort, int, uint, long, ulong,
  *             longlong, ulonglong, float, double, longdouble,
- *             cfloat, cdouble, clongdouble, char, char, char, PyObject *,
- *             datetime, timedelta#
- * #skip = 1*17, aip->descr->elsize*3, 1*3#
+ *             cfloat, cdouble, clongdouble, char, char, char, PyObject *#
+ * #skip = 1*17, aip->descr->elsize*3, 1*1#
  */
 static void
 @FROMTYPE at _to_OBJECT(@fromtype@ *ip, PyObject **op, intp n, PyArrayObject *aip,
@@ -1370,13 +904,11 @@
  *
  * #TOTYPE = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,
  *           LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE,
- *           CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, VOID, DATETIME,
- *           TIMEDELTA#
+ *           CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, VOID#
  * #totype = Bool, byte, ubyte, short, ushort, int, uint, long, ulong,
  *           longlong, ulonglong, float, double, longdouble,
- *           cfloat, cdouble, clongdouble, char, char, char, datetime,
- *           timedelta#
- * #skip = 1*17, aop->descr->elsize*3, 1*2#
+ *           cfloat, cdouble, clongdouble, char, char, char#
+ * #skip = 1*17, aop->descr->elsize*3#
  */
 static void
 OBJECT_to_ at TOTYPE@(PyObject **ip, @totype@ *op, intp n,
@@ -1399,13 +931,13 @@
 
 /**begin repeat
  *
- * #from = STRING*22, UNICODE*22, VOID*22#
- * #fromtyp = char*66#
- * #to = (BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, VOID, DATETIME, TIMEDELTA)*3#
- * #totyp = (Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, char, char, char, datetime, timedelta)*3#
- * #oskip = (1*17,aop->descr->elsize*3,1*2)*3#
- * #convert = 1*17, 0*3, 1*2, 1*17, 0*3, 1*2, 0*22#
- * #convstr = (Int*9, Long*2, Float*3, Complex*3, Tuple*3, Long*2)*3#
+ * #from = STRING*20, UNICODE*20, VOID*20#
+ * #fromtyp = char*60#
+ * #to = (BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, STRING, UNICODE, VOID)*3#
+ * #totyp = (Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, char, char, char)*3#
+ * #oskip = (1*17,aop->descr->elsize*3)*3#
+ * #convert = 1*17, 0*3, 1*17, 0*3, 0*20#
+ * #convstr = (Int*9, Long*2, Float*3, Complex*3, Tuple*3)*3#
 */
 static void
 @from at _to_@to@(@fromtyp@ *ip, @totyp@ *op, intp n, PyArrayObject *aip,
@@ -1444,10 +976,10 @@
 
 /**begin repeat
  *
- * #to = STRING*19, UNICODE*19, VOID*19#
- * #totyp = char*19, char*19, char*19#
- * #from = (BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, DATETIME, TIMEDELTA)*3#
- * #fromtyp = (Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble, datetime, timedelta)*3#
+ * #to = STRING*17, UNICODE*17, VOID*17#
+ * #totyp = char*17, char*17, char*17#
+ * #from = (BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE)*3#
+ * #fromtyp = (Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble)*3#
  */
 static void
 @from at _to_@to@(@fromtyp@ *ip, @totyp@ *op, intp n, PyArrayObject *aip,
@@ -1549,11 +1081,11 @@
 
 /**begin repeat
  * #fname = BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG,
- *          ULONGLONG, DATETIME, TIMEDELTA#
+ *          ULONGLONG#
  * #type = byte, ubyte, short, ushort, int, uint, long, ulong, longlong,
- *         ulonglong, datetime, timedelta#
- * #func = (l, ul)*5, l, l#
- * #btype = (long, ulong)*5, long, long#
+ *         ulonglong#
+ * #func = (l, ul)*5#
+ * #btype = (long, ulong)*5#
  */
 static int
 @fname at _fromstr(char *str, @type@ *ip, char **endptr, PyArray_Descr *NPY_UNUSED(ignore))
@@ -1596,11 +1128,11 @@
 /**begin repeat
  *
  * #fname = SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT,
- *          DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA#
+ *          DOUBLE, LONGDOUBLE#
  * #fsize = SHORT, SHORT, INT, INT, LONG, LONG, LONGLONG, LONGLONG, FLOAT,
- *          DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA#
+ *          DOUBLE, LONGDOUBLE#
  * #type = short, ushort, int, uint, long, ulong, longlong, ulonglong, float,
- *         double, longdouble, datetime, timedelta#
+ *         double, longdouble#
  */
 static void
 @fname at _copyswapn (void *dst, intp dstride, void *src, intp sstride,
@@ -2090,8 +1622,8 @@
 /****************** nonzero **********************************/
 
 /**begin repeat
-#fname=BOOL,BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE,DATETIME,TIMEDELTA#
-#type=Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble, datetime, timedelta#
+#fname=BOOL,BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE#
+#type=Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble#
 */
 static Bool
 @fname at _nonzero (char *ip, PyArrayObject *ap)
@@ -2293,9 +1825,9 @@
 
 /**begin repeat
  * #TYPE = BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,
- *         LONGLONG, ULONGLONG, DATETIME, TIMEDELTA#
+ *         LONGLONG, ULONGLONG#
  * #type = byte, ubyte, short, ushort, int, uint, long, ulong,
- *         longlong, ulonglong, datetime, timedelta#
+ *         longlong, ulonglong#
  */
 
 static int
@@ -2551,9 +2083,9 @@
 
 /**begin repeat
 
-#fname= BOOL,BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE, DATETIME, TIMEDELTA#
-#type= Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble, float, double, longdouble, datetime, timedelta#
-#incr= ip++*14, ip+=2*3, ip++*2#
+#fname= BOOL,BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE#
+#type= Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble, float, double, longdouble#
+#incr= ip++*14, ip+=2*3#
 */
 
 static int
@@ -2641,9 +2173,9 @@
 }
 
 /**begin repeat
-#name=BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA#
-#type= byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble, datetime, timedelta#
-#out= long, ulong, long, ulong, long, ulong, long, ulong, longlong, ulonglong, float, double, longdouble, datetime, timedelta#
+#name=BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE#
+#type= byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble#
+#out= long, ulong, long, ulong, long, ulong, long, ulong, longlong, ulonglong, float, double, longdouble#
 */
 static void
 @name at _dot(char *ip1, intp is1, char *ip2, intp is2, char *op, intp n,
@@ -2746,8 +2278,8 @@
 }
 
 /**begin repeat
-#NAME=BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE,DATETIME,TIMEDELTA#
-#typ=byte,ubyte,short,ushort,int,uint,long,ulong,longlong,ulonglong,float,double,longdouble,datetime,timedelta#
+#NAME=BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE#
+#typ=byte,ubyte,short,ushort,int,uint,long,ulong,longlong,ulonglong,float,double,longdouble#
 */
 static void
 @NAME at _fill(@typ@ *buffer, intp length, void *NPY_UNUSED(ignored))
@@ -2812,8 +2344,8 @@
 /**end repeat**/
 
 /**begin repeat
-#NAME=SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE,CFLOAT,CDOUBLE,CLONGDOUBLE,DATETIME,TIMEDELTA#
-#typ=short,ushort,int,uint,long,ulong,longlong,ulonglong,float,double,longdouble,cfloat,cdouble,clongdouble,datetime,timedelta#
+#NAME=SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE,CFLOAT,CDOUBLE,CLONGDOUBLE#
+#typ=short,ushort,int,uint,long,ulong,longlong,ulonglong,float,double,longdouble,cfloat,cdouble,clongdouble#
 */
 static void
 @NAME at _fillwithscalar(@typ@ *buffer, intp length, @typ@ *value, void *NPY_UNUSED(ignored))
@@ -2834,8 +2366,8 @@
  *************************/
 
 /**begin repeat
-#name=BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, DATETIME, TIMEDELTA#
-#type= Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble, datetime, timedelta#
+#name=BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE#
+#type= Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble#
 */
 static void
 @name at _fastclip(@type@ *in, intp ni, @type@ *min, @type@ *max, @type@ *out)
@@ -2933,8 +2465,8 @@
  *************************/
 
 /**begin repeat
-#name=BOOL,BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE,CFLOAT, CDOUBLE, CLONGDOUBLE, DATETIME, TIMEDELTA#
-#type= Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble,cfloat, cdouble, clongdouble, datetime, timedelta#
+#name=BOOL,BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE,CFLOAT, CDOUBLE, CLONGDOUBLE#
+#type= Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble,cfloat, cdouble, clongdouble#
 */
 static void
 @name at _fastputmask(@type@ *in, Bool *mask, intp ni, @type@ *vals, intp nv)
@@ -2970,8 +2502,8 @@
  *************************/
 
 /**begin repeat
-#name=BOOL,BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE,CFLOAT, CDOUBLE, CLONGDOUBLE, DATETIME, TIMEDELTA#
-#type= Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble,cfloat, cdouble, clongdouble, datetime, timedelta#
+#name=BOOL,BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG, LONGLONG, ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE,CFLOAT, CDOUBLE, CLONGDOUBLE#
+#type= Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble,cfloat, cdouble, clongdouble#
 */
 static int
 @name at _fasttake(@type@ *dest, @type@ *src, intp *indarray,
@@ -3088,8 +2620,6 @@
         (PyArray_VectorUnaryFunc*)@from at _to_STRING,
         (PyArray_VectorUnaryFunc*)@from at _to_UNICODE,
         (PyArray_VectorUnaryFunc*)@from at _to_VOID,
-        (PyArray_VectorUnaryFunc*)@from at _to_DATETIME,
-        (PyArray_VectorUnaryFunc*)@from at _to_TIMEDELTA
     },
     (PyArray_GetItemFunc*)@from at _getitem,
     (PyArray_SetItemFunc*)@from at _setitem,
@@ -3138,13 +2668,13 @@
 
 /**begin repeat
 
-#from= BOOL,BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE,CFLOAT,CDOUBLE,CLONGDOUBLE,OBJECT,DATETIME,TIMEDELTA#
-#num= 1*14,2*3,1*3#
-#fromtyp= Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble, float, double, longdouble, PyObject *, datetime, timedelta#
-#NAME= Bool, Byte, UByte, Short, UShort, Int, UInt, Long, ULong, LongLong, ULongLong, Float, Double, LongDouble, CFloat, CDouble, CLongDouble, Object, Datetime, Timedelta#
-#kind= GENBOOL, SIGNED, UNSIGNED, SIGNED, UNSIGNED, SIGNED, UNSIGNED, SIGNED, UNSIGNED, SIGNED, UNSIGNED, FLOATING, FLOATING, FLOATING, COMPLEX, COMPLEX, COMPLEX, OBJECT, DATETIME, TIMEDELTA#
-#endian= |*3, =*14, |, =*2#
-#isobject= 0*17,NPY_OBJECT_DTYPE_FLAGS,0*2#
+#from= BOOL,BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE,CFLOAT,CDOUBLE,CLONGDOUBLE,OBJECT#
+#num= 1*14,2*3,1*1#
+#fromtyp= Bool, byte, ubyte, short, ushort, int, uint, long, ulong, longlong, ulonglong, float, double, longdouble, float, double, longdouble, PyObject *#
+#NAME= Bool, Byte, UByte, Short, UShort, Int, UInt, Long, ULong, LongLong, ULongLong, Float, Double, LongDouble, CFloat, CDouble, CLongDouble, Object#
+#kind= GENBOOL, SIGNED, UNSIGNED, SIGNED, UNSIGNED, SIGNED, UNSIGNED, SIGNED, UNSIGNED, SIGNED, UNSIGNED, FLOATING, FLOATING, FLOATING, COMPLEX, COMPLEX, COMPLEX, OBJECT#
+#endian= |*3, =*14, |#
+#isobject= 0*17,NPY_OBJECT_DTYPE_FLAGS#
 */
 
 static PyArray_ArrFuncs _Py at NAME@_ArrFuncs = {
@@ -3170,8 +2700,6 @@
         (PyArray_VectorUnaryFunc*)@from at _to_STRING,
         (PyArray_VectorUnaryFunc*)@from at _to_UNICODE,
         (PyArray_VectorUnaryFunc*)@from at _to_VOID,
-        (PyArray_VectorUnaryFunc*)@from at _to_DATETIME,
-        (PyArray_VectorUnaryFunc*)@from at _to_TIMEDELTA
     },
     (PyArray_GetItemFunc*)@from at _getitem,
     (PyArray_SetItemFunc*)@from at _setitem,
@@ -3218,25 +2746,6 @@
 
 /**end repeat**/
 
-static void
-_init_datetime_descr(PyArray_Descr *descr)
-{
-    PyArray_DatetimeMetaData *dt_data;
-    PyObject *cobj;
-
-    dt_data = _pya_malloc(sizeof(PyArray_DatetimeMetaData));
-    dt_data->base = NPY_FR_us;
-    dt_data->num = 1;
-    dt_data->den = 1;
-    dt_data->events = 1;
-
-    cobj = PyCObject_FromVoidPtr((void *)dt_data, _pya_free);
-    descr->metadata = PyDict_New();
-    PyDict_SetItemString(descr->metadata, NPY_METADATA_DTSTR, cobj);
-    Py_DECREF(cobj);
-
-}
-
 #define _MAX_LETTER 128
 static char _letter_to_num[_MAX_LETTER];
 
@@ -3262,8 +2771,6 @@
     &STRING_Descr,
     &UNICODE_Descr,
     &VOID_Descr,
-    &DATETIME_Descr,
-    &TIMEDELTA_Descr,
 };
 
 /*NUMPY_API
@@ -3318,13 +2825,6 @@
         Py_INCREF(ret);
     }
 
-    /* Make sure dtype metadata is initialized for DATETIME */
-    if (PyTypeNum_ISDATETIME(type)) {
-        if (ret->metadata == NULL) {
-            _init_datetime_descr(ret);
-        }
-    }
-
     return ret;
 }
 
@@ -3340,14 +2840,14 @@
     }
 
 /**begin repeat
-#name=BOOL,BYTE,UBYTE,SHORT,USHORT,INT,UINT,INTP,UINTP,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE,CFLOAT,CDOUBLE,CLONGDOUBLE,OBJECT,STRING,UNICODE,VOID,DATETIME,TIMEDELTA#
+#name=BOOL,BYTE,UBYTE,SHORT,USHORT,INT,UINT,INTP,UINTP,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE,CFLOAT,CDOUBLE,CLONGDOUBLE,OBJECT,STRING,UNICODE,VOID#
 */
     _letter_to_num[PyArray_ at name@LTR] = PyArray_ at name@;
 /**end repeat**/
     _letter_to_num[PyArray_STRINGLTR2] = PyArray_STRING;
 
 /**begin repeat
-#name=BOOL,BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE,CFLOAT,CDOUBLE,CLONGDOUBLE,OBJECT,STRING,UNICODE,VOID,DATETIME,TIMEDELTA#
+#name=BOOL,BYTE,UBYTE,SHORT,USHORT,INT,UINT,LONG,ULONG,LONGLONG,ULONGLONG,FLOAT,DOUBLE,LONGDOUBLE,CFLOAT,CDOUBLE,CLONGDOUBLE,OBJECT,STRING,UNICODE,VOID#
 */
     @name at _Descr.fields = Py_None;
 /**end repeat**/
@@ -3429,22 +2929,6 @@
                 (PyObject *)\
                 &PyVoidArrType_Type));
     Py_DECREF(s);
-    PyDict_SetItemString(infodict, "DATETIME",
-            s=Py_BuildValue("ciiiNNO", PyArray_DATETIMELTR,
-                PyArray_DATETIME,
-                sizeof(npy_datetime)*CHAR_BIT,
-                _ALIGN(npy_datetime),
-                MyPyLong_FromInt64(MAX_DATETIME), MyPyLong_FromInt64(MIN_DATETIME),
-                (PyObject *)&PyDatetimeArrType_Type));
-    Py_DECREF(s);
-    PyDict_SetItemString(infodict, "TIMEDELTA",
-            s=Py_BuildValue("ciiiNNO", PyArray_TIMEDELTALTR,
-                PyArray_TIMEDELTA,
-                sizeof(npy_timedelta)*CHAR_BIT,
-                _ALIGN(npy_timedelta),
-                MyPyLong_FromInt64(MAX_TIMEDELTA), MyPyLong_FromInt64(MIN_TIMEDELTA),
-                (PyObject *)&PyTimedeltaArrType_Type));
-    Py_DECREF(s);
 
 #define SETTYPE(name)                           \
     Py_INCREF(&Py##name##ArrType_Type);     \
@@ -3456,7 +2940,6 @@
     SETTYPE(Integer);
     SETTYPE(Inexact);
     SETTYPE(SignedInteger);
-    SETTYPE(TimeInteger);
     SETTYPE(UnsignedInteger);
     SETTYPE(Floating);
     SETTYPE(ComplexFloating);

Modified: branches/1.4.x/numpy/core/src/multiarray/convert_datatype.c
===================================================================
--- branches/1.4.x/numpy/core/src/multiarray/convert_datatype.c	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/src/multiarray/convert_datatype.c	2010-02-09 06:11:19 UTC (rev 8098)
@@ -510,10 +510,6 @@
     if (totype == PyArray_BOOL) {
         return 0;
     }
-    if (fromtype == PyArray_DATETIME || fromtype == PyArray_TIMEDELTA ||
-            totype == PyArray_DATETIME || totype == PyArray_TIMEDELTA) {
-        return 0;
-    }
     if (totype == PyArray_OBJECT || totype == PyArray_VOID) {
         return 1;
     }

Deleted: branches/1.4.x/numpy/core/src/multiarray/datetime.c
===================================================================
--- branches/1.4.x/numpy/core/src/multiarray/datetime.c	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/src/multiarray/datetime.c	2010-02-09 06:11:19 UTC (rev 8098)
@@ -1,910 +0,0 @@
-#define PY_SSIZE_T_CLEAN
-#include <Python.h>
-#include <datetime.h>
-
-#include <time.h>
-
-#define _MULTIARRAYMODULE
-#define NPY_NO_PREFIX
-#include <numpy/ndarrayobject.h>
-
-#include "npy_config.h"
-
-#include "_datetime.h"
-
-/* For defaults and errors */
-#define NPY_FR_ERR  -1
-
-/* Offset for number of days between Dec 31, 1969 and Jan 1, 0001
-*  Assuming Gregorian calendar was always in effect (proleptic Gregorian calendar)
-*/
-
-/* Calendar Structure for Parsing Long -> Date */
-typedef struct {
-    int year, month, day;
-} ymdstruct;
-
-typedef struct {
-    int hour, min, sec;
-} hmsstruct;
-
-
-/*
-  ====================================================
-  == Beginning of section borrowed from mx.DateTime ==
-  ====================================================
-*/
-
-/*
- * Functions in the following section are borrowed from mx.DateTime version
- * 2.0.6, and hence this code is subject to the terms of the egenix public
- * license version 1.0.0
- */
-
-#define Py_AssertWithArg(x,errortype,errorstr,a1) {if (!(x)) {PyErr_Format(errortype,errorstr,a1);goto onError;}}
-
-/* Table with day offsets for each month (0-based, without and with leap) */
-static int month_offset[2][13] = {
-    { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
-    { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
-};
-
-/* Table of number of days in a month (0-based, without and with leap) */
-static int days_in_month[2][12] = {
-    { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
-    { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
-};
-
-/* Return 1/0 iff year points to a leap year in calendar. */
-static int
-is_leapyear(register long year)
-{
-    return (year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0));
-}
-
-
-/*
- * Return the day of the week for the given absolute date.
- * Monday is 0 and Sunday is 6
- */
-static int
-day_of_week(npy_longlong absdate)
-{
-    /* Add in four for the Thursday on Jan 1, 1970 (epoch offset)*/
-    absdate += 4;
-
-    if (absdate >= 0) {
-        return absdate % 7;
-    }
-    else {
-        return 6 + (absdate + 1) % 7;
-    }
-}
-
-/*
- * Return the year offset, that is the absolute date of the day
- * 31.12.(year-1) since 31.12.1969 in the proleptic Gregorian calendar.
- */
-static npy_longlong
-year_offset(register npy_longlong year)
-{
-    /* Note that 477 == 1969/4 - 1969/100 + 1969/400 */
-    year--;
-    if (year >= 0 || -1/4 == -1)
-        return (year-1969)*365 + year/4 - year/100 + year/400 - 477;
-    else
-        return (year-1969)*365 + (year-3)/4 - (year-99)/100 + (year-399)/400 - 477;
-}
-
-/*
- * Modified version of mxDateTime function
- * Returns absolute number of days since Jan 1, 1970
- * assuming a proleptic Gregorian Calendar
- * Raises a ValueError if out of range month or day
- * day -1 is Dec 31, 1969, day 0 is Jan 1, 1970, day 1 is Jan 2, 1970
- */
-static npy_longlong
-days_from_ymd(int year, int month, int day)
-{
-
-    /* Calculate the absolute date */
-    int leap;
-    npy_longlong yearoffset, absdate;
-
-    /* Is it a leap year ? */
-    leap = is_leapyear(year);
-
-    /* Negative month values indicate months relative to the years end */
-    if (month < 0) month += 13;
-    Py_AssertWithArg(month >= 1 && month <= 12,
-                     PyExc_ValueError,
-                     "month out of range (1-12): %i",
-                     month);
-
-    /* Negative values indicate days relative to the months end */
-    if (day < 0) day += days_in_month[leap][month - 1] + 1;
-    Py_AssertWithArg(day >= 1 && day <= days_in_month[leap][month - 1],
-                     PyExc_ValueError,
-                     "day out of range: %i",
-                     day);
-
-    /*
-     * Number of days between Dec 31, (year - 1) and Dec 31, 1969
-     *    (can be negative).
-     */
-    yearoffset = year_offset(year);
-
-    if (PyErr_Occurred()) goto onError;
-
-    /*
-     * Calculate the number of days using yearoffset
-     * Jan 1, 1970 is day 0 and thus Dec. 31, 1969 is day -1
-     */
-    absdate = day-1 + month_offset[leap][month - 1] + yearoffset;
-
-    return absdate;
-
- onError:
-    return 0;
-
-}
-
-/* Returns absolute seconds from an hour, minute, and second
- */
-#define secs_from_hms(hour, min, sec) ((hour)*3600 + (min)*60 + (sec))
-
-/*
- * Takes a number of days since Jan 1, 1970 (positive or negative)
- * and returns the year. month, and day in the proleptic
- * Gregorian calendar
- *
- * Examples:
- *
- * -1 returns 1969, 12, 31
- * 0  returns 1970, 1, 1
- * 1  returns 1970, 1, 2
- */
-
-static ymdstruct
-days_to_ymdstruct(npy_datetime dlong)
-{
-    ymdstruct ymd;
-    register long year;
-    npy_longlong yearoffset;
-    int leap, dayoffset;
-    int month = 1, day = 1;
-    int *monthoffset;
-
-    dlong += 1;
-
-    /* Approximate year */
-    year = 1970 + dlong / 365.2425;
-
-    /* Apply corrections to reach the correct year */
-    while (1) {
-        /* Calculate the year offset */
-        yearoffset = year_offset(year);
-
-        /*
-         * Backward correction: absdate must be greater than the
-         * yearoffset
-         */
-        if (yearoffset >= dlong) {
-            year--;
-            continue;
-        }
-
-        dayoffset = dlong - yearoffset;
-        leap = is_leapyear(year);
-
-        /* Forward correction: non leap years only have 365 days */
-        if (dayoffset > 365 && !leap) {
-            year++;
-            continue;
-        }
-        break;
-    }
-
-    /* Now iterate to find the month */
-    monthoffset = month_offset[leap];
-    for (month = 1; month < 13; month++) {
-        if (monthoffset[month] >= dayoffset)
-            break;
-    }
-    day = dayoffset - month_offset[leap][month-1];
-
-    ymd.year  = year;
-    ymd.month = month;
-    ymd.day   = day;
-
-    return ymd;
-}
-
-/*
- * Converts an integer number of seconds in a day to hours minutes seconds.
- * It assumes seconds is between 0 and 86399.
- */
-
-static hmsstruct
-seconds_to_hmsstruct(npy_longlong dlong)
-{
-    int hour, minute, second;
-    hmsstruct hms;
-
-    hour   = dlong / 3600;
-    minute = (dlong % 3600) / 60;
-    second = dlong - (hour*3600 + minute*60);
-
-    hms.hour   = hour;
-    hms.min = minute;
-    hms.sec = second;
-
-    return hms;
-}
-
-/*
-  ====================================================
-  == End of section adapted from mx.DateTime       ==
-  ====================================================
-*/
-
-
-/*==================================================
-// Parsing DateTime struct and returns a date-time number
-// =================================================
-
- Structure is assumed to be already normalized
-*/
-
-/*
- * Create a datetime value from a filled datetime struct and resolution unit.
- */
-NPY_NO_EXPORT npy_datetime
-PyArray_DatetimeStructToDatetime(NPY_DATETIMEUNIT fr, npy_datetimestruct *d)
-{
-    npy_datetime ret;
-    npy_longlong days; /* The absolute number of days since Jan 1, 1970 */
-
-    if (fr > NPY_FR_M) {
-        days = days_from_ymd(d->year, d->month, d->day);
-    }
-    if (fr == NPY_FR_Y) {
-        ret = d->year - 1970;
-    }
-    else if (fr == NPY_FR_M) {
-        ret = (d->year - 1970) * 12 + d->month - 1;
-    }
-    else if (fr == NPY_FR_W) {
-        /* This is just 7-days for now. */
-        if (days >= 0) {
-            ret = days / 7;
-        }
-        else {
-            ret = (days - 6) / 7;
-        }
-    }
-    else if (fr == NPY_FR_B) {
-        npy_longlong x;
-        int dotw = day_of_week(days);
-
-        if (dotw > 4) {
-            /* Invalid business day */
-            ret = 0;
-        }
-        else {
-            if (days >= 0) {
-                /* offset to adjust first week */
-                x = days - 4;
-            }
-            else {
-                x = days - 2;
-            }
-            ret = 2 + (x / 7) * 5 + x % 7;
-        }
-    }
-    else if (fr == NPY_FR_D) {
-        ret = days;
-    }
-    else if (fr == NPY_FR_h) {
-        ret = days * 24 + d->hour;
-    }
-    else if (fr == NPY_FR_m) {
-        ret = days * 1440 + d->hour * 60 + d->min;
-    }
-    else if (fr == NPY_FR_s) {
-        ret = days * 86400 + secs_from_hms(d->hour, d->min, d->sec);
-    }
-    else if (fr == NPY_FR_ms) {
-        ret = days * 86400000 + secs_from_hms(d->hour, d->min, d->sec) * 1000
-            + (d->us / 1000);
-    }
-    else if (fr == NPY_FR_us) {
-        npy_int64 num = 86400 * 1000;
-        num *= 1000;
-        ret = days * num + secs_from_hms(d->hour, d->min, d->sec) * 1000000
-            + d->us;
-    }
-    else if (fr == NPY_FR_ns) {
-        npy_int64 num = 86400 * 1000;
-        num *= 1000 * 1000;
-        ret = days * num + secs_from_hms(d->hour, d->min, d->sec) * 1000000000
-            + d->us * 1000 + (d->ps / 1000);
-    }
-    else if (fr == NPY_FR_ps) {
-        npy_int64 num2 = 1000 * 1000;
-        npy_int64 num1;
-
-        num2 *= 1000 * 1000;
-        num1 = 86400 * num2;
-        ret = days * num1 + secs_from_hms(d->hour, d->min, d->sec) * num2
-            + d->us * 1000000 + d->ps;
-    }
-    else if (fr == NPY_FR_fs) {
-        /* only 2.6 hours */
-        npy_int64 num2 = 1000000;
-        num2 *= 1000000;
-        num2 *= 1000;
-
-        /* get number of seconds as a postive or negative number */
-        if (days >= 0) {
-            ret = secs_from_hms(d->hour, d->min, d->sec);
-        }
-        else {
-            ret = ((d->hour - 24)*3600 + d->min*60 + d->sec);
-        }
-        ret = ret * num2 + d->us * 1000000000 + d->ps * 1000 + (d->as / 1000);
-    }
-    else if (fr == NPY_FR_as) {
-        /* only 9.2 secs */
-        npy_int64 num1, num2;
-
-        num1 = 1000000;
-        num1 *= 1000000;
-        num2 = num1 * 1000000;
-
-        if (days >= 0) {
-            ret = d->sec;
-        }
-        else {
-            ret = d->sec - 60;
-        }
-        ret = ret * num2 + d->us * num1 + d->ps * 1000000 + d->as;
-    }
-    else {
-        /* Shouldn't get here */
-        PyErr_SetString(PyExc_ValueError, "invalid internal frequency");
-        ret = -1;
-    }
-
-    return ret;
-}
-
-/* Uses Average values when frequency is Y, M, or B */
-
-#define _DAYS_PER_MONTH 30.436875
-#define _DAYS_PER_YEAR  365.2425
-
-/*
- * Create a timdelta value from a filled timedelta struct and resolution unit.
- */
-NPY_NO_EXPORT npy_datetime
-PyArray_TimedeltaStructToTimedelta(NPY_DATETIMEUNIT fr, npy_timedeltastruct *d)
-{
-    npy_datetime ret;
-
-    if (fr == NPY_FR_Y) {
-        ret = d->day / _DAYS_PER_YEAR;
-    }
-    else if (fr == NPY_FR_M) {
-        ret = d->day / _DAYS_PER_MONTH;
-    }
-    else if (fr == NPY_FR_W) {
-        /* This is just 7-days for now. */
-        if (d->day >= 0) {
-            ret = d->day / 7;
-        }
-        else {
-            ret = (d->day - 6) / 7;
-        }
-    }
-    else if (fr == NPY_FR_B) {
-        /*
-         * What is the meaning of a relative Business day?
-         *
-         * This assumes you want to take the day difference and
-         * convert it to business-day difference (removing 2 every 7).
-         */
-        ret = (d->day / 7) * 5 + d->day % 7;
-    }
-    else if (fr == NPY_FR_D) {
-        ret = d->day;
-    }
-    else if (fr == NPY_FR_h) {
-        ret = d->day + d->sec / 3600;
-    }
-    else if (fr == NPY_FR_m) {
-        ret = d->day * 1440 + d->sec / 60;
-    }
-    else if (fr == NPY_FR_s) {
-        ret = d->day * 86400 + d->sec;
-    }
-    else if (fr == NPY_FR_ms) {
-        ret = d->day * 86400000 + d->sec * 1000 + d->us / 1000;
-    }
-    else if (fr == NPY_FR_us) {
-        npy_int64 num = 86400000;
-        num *= 1000;
-        ret = d->day * num + d->sec * 1000000 + d->us;
-    }
-    else if (fr == NPY_FR_ns) {
-        npy_int64 num = 86400000;
-        num *= 1000000;
-        ret = d->day * num + d->sec * 1000000000 + d->us * 1000 + (d->ps / 1000);
-    }
-    else if (fr == NPY_FR_ps) {
-        npy_int64 num2, num1;
-
-        num2 = 1000000;
-        num2 *= 1000000;
-        num1 = 86400 * num2;
-
-        ret = d->day * num1 + d->sec * num2 + d->us * 1000000 + d->ps;
-    }
-    else if (fr == NPY_FR_fs) {
-        /* only 2.6 hours */
-        npy_int64 num2 = 1000000000;
-        num2 *= 1000000;
-        ret = d->sec * num2 + d->us * 1000000000 + d->ps * 1000 + (d->as / 1000);
-    }
-    else if (fr == NPY_FR_as) {
-        /* only 9.2 secs */
-        npy_int64 num1, num2;
-
-        num1 = 1000000;
-        num1 *= 1000000;
-        num2 = num1 * 1000000;
-        ret = d->sec * num2 + d->us * num1 + d->ps * 1000000 + d->as;
-    }
-    else {
-        /* Shouldn't get here */
-        PyErr_SetString(PyExc_ValueError, "invalid internal frequency");
-        ret = -1;
-    }
-
-    return ret;
-}
-
-
-
-/*
- * Fill the datetime struct from the value and resolution unit.
- */
-NPY_NO_EXPORT void
-PyArray_DatetimeToDatetimeStruct(npy_datetime val, NPY_DATETIMEUNIT fr,
-                                 npy_datetimestruct *result)
-{
-    int year = 1970, month = 1, day = 1,
-        hour = 0, min = 0, sec = 0,
-        us = 0, ps = 0, as = 0;
-
-    npy_int64 tmp;
-    ymdstruct ymd;
-    hmsstruct hms;
-
-    /*
-     * Note that what looks like val / N and val % N for positive numbers maps to
-     * [val - (N-1)] / N and [N-1 + (val+1) % N] for negative numbers (with the 2nd
-     * value, the remainder, being positive in both cases).
-     */
-    if (fr == NPY_FR_Y) {
-        year = 1970 + val;
-    }
-    else if (fr == NPY_FR_M) {
-        if (val >= 0) {
-            year  = 1970 + val / 12;
-            month = val % 12 + 1;
-        }
-        else {
-            year  = 1969 + (val + 1) / 12;
-            month = 12 + (val + 1)% 12;
-        }
-    }
-    else if (fr == NPY_FR_W) {
-        /* A week is the same as 7 days */
-        ymd = days_to_ymdstruct(val * 7);
-        year  = ymd.year;
-        month = ymd.month;
-        day   = ymd.day;
-    }
-    else if (fr == NPY_FR_B) {
-        /* Number of business days since Thursday, 1-1-70 */
-        npy_longlong absdays;
-        /*
-         * A buisness day is M T W Th F (i.e. all but Sat and Sun.)
-         * Convert the business day to the number of actual days.
-         *
-         * Must convert [0,1,2,3,4,5,6,7,...] to
-         *                  [0,1,4,5,6,7,8,11,...]
-         * and  [...,-9,-8,-7,-6,-5,-4,-3,-2,-1,0] to
-         *        [...,-13,-10,-9,-8,-7,-6,-3,-2,-1,0]
-         */
-        if (val >= 0) {
-            absdays = 7 * ((val + 3) / 5) + ((val + 3) % 5) - 3;
-        }
-        else {
-            /* Recall how C computes / and % with negative numbers */
-            absdays = 7 * ((val - 1) / 5) + ((val - 1) % 5) + 1;
-        }
-        ymd = days_to_ymdstruct(absdays);
-        year  = ymd.year;
-        month = ymd.month;
-        day   = ymd.day;
-    }
-    else if (fr == NPY_FR_D) {
-        ymd = days_to_ymdstruct(val);
-        year  = ymd.year;
-        month = ymd.month;
-        day   = ymd.day;
-    }
-    else if (fr == NPY_FR_h) {
-        if (val >= 0) {
-            ymd  = days_to_ymdstruct(val / 24);
-            hour  = val % 24;
-        }
-        else {
-            ymd  = days_to_ymdstruct((val - 23) / 24);
-            hour = 23 + (val + 1) % 24;
-        }
-        year  = ymd.year;
-        month = ymd.month;
-        day   = ymd.day;
-    }
-    else if (fr == NPY_FR_m) {
-        if (val >= 0) {
-            ymd = days_to_ymdstruct(val / 1440);
-            min = val % 1440;
-        }
-        else {
-            ymd = days_to_ymdstruct((val - 1439) / 1440);
-            min = 1439 + (val + 1) % 1440;
-        }
-        hms = seconds_to_hmsstruct(min * 60);
-        year   = ymd.year;
-        month  = ymd.month;
-        day    = ymd.day;
-        hour   = hms.hour;
-        min = hms.min;
-    }
-    else if (fr == NPY_FR_s) {
-        if (val >= 0) {
-            ymd = days_to_ymdstruct(val / 86400);
-            sec = val % 86400;
-        }
-        else {
-            ymd = days_to_ymdstruct((val - 86399) / 86400);
-            sec = 86399 + (val + 1) % 86400;
-        }
-        hms = seconds_to_hmsstruct(val);
-        year   = ymd.year;
-        month  = ymd.month;
-        day    = ymd.day;
-        hour   = hms.hour;
-        min = hms.min;
-        sec = hms.sec;
-    }
-    else if (fr == NPY_FR_ms) {
-        if (val >= 0) {
-            ymd = days_to_ymdstruct(val / 86400000);
-            tmp  = val % 86400000;
-        }
-        else {
-            ymd = days_to_ymdstruct((val - 86399999) / 86400000);
-            tmp  = 86399999 + (val + 1) % 86399999;
-        }
-        hms = seconds_to_hmsstruct(tmp / 1000);
-        us  = (tmp % 1000)*1000;
-        year    = ymd.year;
-        month   = ymd.month;
-        day     = ymd.day;
-        hour    = hms.hour;
-        min     = hms.min;
-        sec     = hms.sec;
-    }
-    else if (fr == NPY_FR_us) {
-        npy_int64 num1, num2;
-        num1 = 86400000;
-        num1 *= 1000;
-        num2 = num1 - 1;
-        if (val >= 0) {
-            ymd = days_to_ymdstruct(val / num1);
-            tmp = val % num1;
-        }
-        else {
-            ymd = days_to_ymdstruct((val - num2)/ num1);
-            tmp = num2 + (val + 1) % num1;
-        }
-        hms = seconds_to_hmsstruct(tmp / 1000000);
-        us = tmp % 1000000;
-        year    = ymd.year;
-        month   = ymd.month;
-        day     = ymd.day;
-        hour    = hms.hour;
-        min     = hms.min;
-        sec     = hms.sec;
-    }
-    else if (fr == NPY_FR_ns) {
-        npy_int64 num1, num2, num3;
-        num1 = 86400000;
-        num1 *= 1000000000;
-        num2 = num1 - 1;
-        num3 = 1000000;
-        num3 *= 1000000;
-        if (val >= 0) {
-            ymd = days_to_ymdstruct(val / num1);
-            tmp = val % num1;
-        }
-        else {
-            ymd = days_to_ymdstruct((val - num2)/ num1);
-            tmp = num2 + (val + 1) % num1;
-        }
-        hms = seconds_to_hmsstruct(tmp / 1000000000);
-        tmp = tmp % 1000000000;
-        us = tmp / 1000;
-        ps = (tmp % 1000) * 1000;
-        year    = ymd.year;
-        month   = ymd.month;
-        day     = ymd.day;
-        hour    = hms.hour;
-        min     = hms.min;
-        sec     = hms.sec;
-    }
-    else if (fr == NPY_FR_ps) {
-        npy_int64 num1, num2, num3;
-        num3 = 1000000000;
-        num3 *= 1000;
-        num1 = 86400 * num3;
-        num2 = num1 - 1;
-
-        if (val >= 0) {
-            ymd = days_to_ymdstruct(val / num1);
-            tmp = val % num1;
-        }
-        else {
-            ymd = days_to_ymdstruct((val - num2)/ num1);
-            tmp = num2 + (val + 1) % num1;
-        }
-        hms = seconds_to_hmsstruct(tmp / num3);
-        tmp = tmp % num3;
-        us = tmp / 1000000;
-        ps = tmp % 1000000;
-        year    = ymd.year;
-        month   = ymd.month;
-        day     = ymd.day;
-        hour    = hms.hour;
-        min     = hms.min;
-        sec     = hms.sec;
-    }
-    else if (fr == NPY_FR_fs) {
-        /* entire range is only += 2.6 hours */
-        npy_int64 num1, num2;
-        num1 = 1000000000;
-        num1 *= 1000;
-        num2 = num1 * 1000;
-
-        if (val >= 0) {
-            sec = val / num2;
-            tmp = val % num2;
-            hms = seconds_to_hmsstruct(sec);
-            hour = hms.hour;
-            min = hms.min;
-            sec = hms.sec;
-        }
-        else {
-            /* tmp (number of fs) will be positive after this segment */
-            year = 1969;
-            day = 31;
-            month = 12;
-            sec = (val - (num2-1))/num2;
-            tmp = (num2-1) + (val + 1) % num2;
-            if (sec == 0) {
-                /* we are at the last second */
-                hour = 23;
-                min = 59;
-                sec = 59;
-            }
-            else {
-                hour = 24 + (sec - 3599)/3600;
-                sec = 3599 + (sec+1)%3600;
-                min = sec / 60;
-                sec = sec % 60;
-            }
-        }
-        us = tmp / 1000000000;
-        tmp = tmp % 1000000000;
-        ps = tmp / 1000;
-        as = (tmp % 1000) * 1000;
-    }
-    else if (fr == NPY_FR_as) {
-        /* entire range is only += 9.2 seconds */
-        npy_int64 num1, num2, num3;
-        num1 = 1000000;
-        num2 = num1 * 1000000;
-        num3 = num2 * 1000000;
-        if (val >= 0) {
-            hour = 0;
-            min = 0;
-            sec = val / num3;
-            tmp = val % num3;
-        }
-        else {
-            year = 1969;
-            day = 31;
-            month = 12;
-            hour = 23;
-            min = 59;
-            sec = 60 + (val - (num3-1)) / num3;
-            tmp = (num3-1) + (val+1) % num3;
-        }
-        us = tmp / num2;
-        tmp = tmp % num2;
-        ps = tmp / num1;
-        as = tmp % num1;
-    }
-    else {
-        PyErr_SetString(PyExc_RuntimeError, "invalid internal time resolution");
-    }
-
-    result->year  = year;
-    result->month = month;
-    result->day   = day;
-    result->hour  = hour;
-    result->min   = min;
-    result->sec   = sec;
-    result->us    = us;
-    result->ps    = ps;
-    result->as    = as;
-
-    return;
-}
-
-/*
- * FIXME: Overflow is not handled at all
- *   To convert from Years, Months, and Business Days, multiplication by the average is done
- */
-
-/*
- * Fill the timedelta struct from the timedelta value and resolution unit.
- */
-NPY_NO_EXPORT void
-PyArray_TimedeltaToTimedeltaStruct(npy_timedelta val, NPY_DATETIMEUNIT fr,
-                                 npy_timedeltastruct *result)
-{
-    npy_longlong day=0;
-    int sec=0, us=0, ps=0, as=0;
-    npy_bool negative=0;
-
-    /*
-     * Note that what looks like val / N and val % N for positive numbers maps to
-     * [val - (N-1)] / N and [N-1 + (val+1) % N] for negative numbers (with the 2nd
-     * value, the remainder, being positive in both cases).
-     */
-
-    if (val < 0) {
-        val = -val;
-        negative = 1;
-    }
-    if (fr == NPY_FR_Y) {
-        day = val * _DAYS_PER_YEAR;
-    }
-    else if (fr == NPY_FR_M) {
-        day = val * _DAYS_PER_MONTH;
-    }
-    else if (fr == NPY_FR_W) {
-        day = val * 7;
-    }
-    else if (fr == NPY_FR_B) {
-        /* Number of business days since Thursday, 1-1-70 */
-        day = (val * 7) / 5;
-    }
-    else if (fr == NPY_FR_D) {
-        day = val;
-    }
-    else if (fr == NPY_FR_h) {
-        day = val / 24;
-        sec = (val % 24)*3600;
-    }
-    else if (fr == NPY_FR_m) {
-        day = val / 1440;
-        sec = (val % 1440)*60;
-    }
-    else if (fr == NPY_FR_s) {
-        day = val / 86400;
-        sec = val % 86400;
-    }
-    else if (fr == NPY_FR_ms) {
-        day = val / 86400000;
-        val = val % 86400000;
-        sec = val / 1000;
-        us = (val % 1000)*1000;
-    }
-    else if (fr == NPY_FR_us) {
-        npy_int64 num1;
-        num1 = 86400000;
-        num1 *= 1000;
-        day = val / num1;
-        us = val % num1;
-        sec = us / 1000000;
-        us = us % 1000000;
-    }
-    else if (fr == NPY_FR_ns) {
-        npy_int64 num1;
-        num1 = 86400000;
-        num1 *= 1000000;
-        day = val / num1;
-        val = val % num1;
-        sec = val / 1000000000;
-        val = val % 1000000000;
-        us  = val / 1000;
-        ps  = (val % 1000) * 1000;
-    }
-    else if (fr == NPY_FR_ps) {
-        npy_int64 num1, num2;
-        num2 = 1000000000;
-        num2 *= 1000;
-        num1 = 86400 * num2;
-
-        day = val / num1;
-        ps = val % num1;
-        sec = ps / num2;
-        ps = ps % num2;
-        us = ps / 1000000;
-        ps = ps % 1000000;
-    }
-    else if (fr == NPY_FR_fs) {
-        /* entire range is only += 9.2 hours */
-        npy_int64 num1, num2;
-        num1 = 1000000000;
-        num2 = num1 * 1000000;
-
-        day = 0;
-        sec = val / num2;
-        val = val % num2;
-        us = val / num1;
-        val = val % num1;
-        ps = val / 1000;
-        as = (val % 1000) * 1000;
-    }
-    else if (fr == NPY_FR_as) {
-        /* entire range is only += 2.6 seconds */
-        npy_int64 num1, num2, num3;
-        num1 = 1000000;
-        num2 = num1 * 1000000;
-        num3 = num2 * 1000000;
-        day = 0;
-        sec = val / num3;
-        as = val % num3;
-        us = as / num2;
-        as = as % num2;
-        ps = as / num1;
-        as = as % num1;
-    }
-    else {
-        PyErr_SetString(PyExc_RuntimeError, "invalid internal time resolution");
-    }
-
-    if (negative) {
-        result->day = -day;
-        result->sec = -sec;
-        result->us = -us;
-        result->ps = -ps;
-        result->as = -as;
-    }
-    else {
-        result->day   = day;
-        result->sec   = sec;
-        result->us    = us;
-        result->ps    = ps;
-        result->as    = as;
-    }
-    return;
-}

Modified: branches/1.4.x/numpy/core/src/multiarray/descriptor.c
===================================================================
--- branches/1.4.x/numpy/core/src/multiarray/descriptor.c	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/src/multiarray/descriptor.c	2010-02-09 06:11:19 UTC (rev 8098)
@@ -125,21 +125,8 @@
     return 0;
 }
 
-static int
-_check_for_datetime(char *type, int len)
-{
-    if (len < 1) return 0;
-    if (type[1] == '8' && (type[0] == 'M' || type[0] == 'm'))
-        return 1;
-    if (len < 10) return 0;
-    if (strncmp(type, "datetime64", 10) == 0) return 1;
-    if (len < 11) return 0;
-    if (strncmp(type, "timedelta64", 11) == 0) return 1;
-    return 0;
-}
 
 
-
 #undef _chk_byteorder
 
 static PyArray_Descr *
@@ -477,234 +464,6 @@
     return NULL;
 }
 
-/* Exported as DATETIMEUNITS in multiarraymodule.c */
-NPY_NO_EXPORT char *_datetime_strings[] = {
-    NPY_STR_Y,
-    NPY_STR_M,
-    NPY_STR_W,
-    NPY_STR_B,
-    NPY_STR_D,
-    NPY_STR_h,
-    NPY_STR_m,
-    NPY_STR_s,
-    NPY_STR_ms,
-    NPY_STR_us,
-    NPY_STR_ns,
-    NPY_STR_ps,
-    NPY_STR_fs,
-    NPY_STR_as
-};
-
-static NPY_DATETIMEUNIT
- _unit_from_str(char *base)
-{
-    NPY_DATETIMEUNIT unit;
-
-    if (base == NULL)
-        return NPY_DATETIME_DEFAULTUNIT;
-
-    unit = NPY_FR_Y;
-    while (unit < NPY_DATETIME_NUMUNITS) {
-        if (strcmp(base, _datetime_strings[unit]) == 0)
-            break;
-        unit++;
-    }
-
-    if (unit == NPY_DATETIME_NUMUNITS)
-        return NPY_DATETIME_DEFAULTUNIT;
-
-    return unit;
-}
-
-static int _multiples_table[16][4] = {
-    {12, 52, 365},                            /* NPY_FR_Y */
-    {NPY_FR_M, NPY_FR_W, NPY_FR_D},
-    {4,  30, 720},                            /* NPY_FR_M */
-    {NPY_FR_W, NPY_FR_D, NPY_FR_h},
-    {5,  7,  168, 10080},                     /* NPY_FR_W */
-    {NPY_FR_B, NPY_FR_D, NPY_FR_h, NPY_FR_m},
-    {24, 1440, 86400},                        /* NPY_FR_B */
-    {NPY_FR_h, NPY_FR_m, NPY_FR_s},
-    {24, 1440, 86400},                        /* NPY_FR_D */
-    {NPY_FR_h, NPY_FR_m, NPY_FR_s},
-    {60, 3600},                               /* NPY_FR_h */
-    {NPY_FR_m, NPY_FR_s},
-    {60, 60000},                              /* NPY_FR_m */
-    {NPY_FR_s, NPY_FR_ms},
-    {1000, 1000000},                          /* >=NPY_FR_s */
-    {0, 0}
-};
-
-
-/* Translate divisors into multiples of smaller units */
-static int
-_convert_divisor_to_multiple(PyArray_DatetimeMetaData *meta)
-{
-    int i, num, ind;
-    int *totry;
-    NPY_DATETIMEUNIT *baseunit;
-    int q, r;
-
-    ind = ((int)meta->base - (int)NPY_FR_Y)*2;
-    totry = _multiples_table[ind];
-    baseunit = (NPY_DATETIMEUNIT *)_multiples_table[ind+1];
-
-    num = 3;
-    if (meta->base == NPY_FR_W) num = 4;
-    else if (meta->base > NPY_FR_D) num = 2;
-
-    if (meta->base >= NPY_FR_s) {
-        ind = ((int)NPY_FR_s - (int)NPY_FR_Y)*2;
-        totry = _multiples_table[ind];
-        baseunit = (NPY_DATETIMEUNIT *)_multiples_table[ind+1];
-        baseunit[0] = meta->base + 1;
-        baseunit[1] = meta->base + 2;
-        if (meta->base == NPY_DATETIME_NUMUNITS-2) num = 1;
-	if (meta->base == NPY_DATETIME_NUMUNITS-1) num = 0;
-    }
-
-    for (i=0; i<num; i++) {
-        q = totry[i] / meta->den;
-        r = totry[i] % meta->den;
-        if (r==0) break;
-    }
-    if (i==num) {
-        PyErr_Format(PyExc_ValueError, "divisor (%d) is not a multiple of a lower-unit", meta->den);
-        return -1;
-    }
-    meta->base = baseunit[i];
-    meta->den = 1;
-    meta->num *= q;
-
-    return 0;
-}
-
-
-static PyObject *
-_get_datetime_tuple_from_cobj(PyObject *cobj)
-{
-    PyArray_DatetimeMetaData *dt_data;
-    PyObject *dt_tuple;
-
-    dt_data = PyCObject_AsVoidPtr(cobj);
-    dt_tuple = PyTuple_New(4);
-
-    PyTuple_SET_ITEM(dt_tuple, 0,
-                     PyString_FromString(_datetime_strings[dt_data->base]));
-    PyTuple_SET_ITEM(dt_tuple, 1,
-                     PyInt_FromLong(dt_data->num));
-    PyTuple_SET_ITEM(dt_tuple, 2,
-                     PyInt_FromLong(dt_data->den));
-    PyTuple_SET_ITEM(dt_tuple, 3,
-                     PyInt_FromLong(dt_data->events));
-
-    return dt_tuple;
-}
-
-static PyObject *
-_convert_datetime_tuple_to_cobj(PyObject *tuple)
-{
-    PyArray_DatetimeMetaData *dt_data;
-
-    dt_data = _pya_malloc(sizeof(PyArray_DatetimeMetaData));
-
-    dt_data->base = _unit_from_str\
-        (PyString_AsString(PyTuple_GET_ITEM(tuple, 0)));
-
-    /* Assumes other objects are Python integers */
-    dt_data->num = PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 1));
-    dt_data->den = PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 2));
-    dt_data->events = PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 3));
-
-    if (dt_data->den > 1) {
-        if (_convert_divisor_to_multiple(dt_data) < 0) return NULL;
-    }
-
-    return PyCObject_FromVoidPtr((void *)dt_data, _pya_free);
-}
-
-static PyArray_Descr *
-_convert_from_datetime_tuple(PyObject *obj)
-{
-    PyArray_Descr *new;
-    PyObject *dt_tuple;
-    PyObject *dt_cobj;
-    PyObject *datetime;
-
-    if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj)!=2) {
-        PyErr_SetString(PyExc_RuntimeError, "_datetimestring is "       \
-                        "not returning a tuple with length 2");
-        return NULL;
-    }
-
-    dt_tuple = PyTuple_GET_ITEM(obj, 0);
-    datetime = PyTuple_GET_ITEM(obj, 1);
-    if (!PyTuple_Check(dt_tuple) || PyTuple_GET_SIZE(dt_tuple) != 4 || \
-        !PyInt_Check(datetime)) {
-        PyErr_SetString(PyExc_RuntimeError, "_datetimestring is "       \
-                        "not returning a length 4 tuple and an integer");
-        return NULL;
-    }
-
-    /* Create new timedelta or datetime dtype */
-    if (PyObject_IsTrue(datetime)) {
-        new = PyArray_DescrNewFromType(PyArray_DATETIME);
-    }
-    else {
-        new = PyArray_DescrNewFromType(PyArray_TIMEDELTA);
-    }
-
-    if (new == NULL) return NULL;
-
-    /* Remove any reference to old metadata dictionary */
-    /* And create a new one for this new dtype */
-    Py_XDECREF(new->metadata);
-    if ((new->metadata = PyDict_New())== NULL) return NULL;
-
-    dt_cobj = _convert_datetime_tuple_to_cobj(dt_tuple);
-    if (dt_cobj == NULL) { /* Failure in conversion */
-        Py_DECREF(new);
-        return NULL;
-    }
-
-    /* Assume this sets a new reference to dt_cobj */
-    PyDict_SetItemString(new->metadata, NPY_METADATA_DTSTR, dt_cobj);
-    Py_DECREF(dt_cobj);
-
-    return new;
-}
-
-
-static PyArray_Descr *
-_convert_from_datetime(PyObject *obj)
-{
-    PyObject *tupleobj;
-    PyArray_Descr *res;
-    PyObject *_numpy_internal;
-
-    if (!PyString_Check(obj)) {
-        return NULL;
-    }
-    _numpy_internal = PyImport_ImportModule("numpy.core._internal");
-    if (_numpy_internal == NULL) {
-        return NULL;
-    }
-    tupleobj = PyObject_CallMethod(_numpy_internal, "_datetimestring", "O", obj);
-    Py_DECREF(_numpy_internal);
-    if (!tupleobj) return NULL;
-    /* tuple of a standard tuple (baseunit, num, den, events) and a
-       timedelta boolean
-    */
-    res = _convert_from_datetime_tuple(tupleobj);
-    Py_DECREF(tupleobj);
-    if (!res && !PyErr_Occurred()) {
-        PyErr_SetString(PyExc_ValueError, "invalid data-type");
-        return NULL;
-    }
-    return res;
-}
-
-
 /*
  * comma-separated string
  * this is the format developed by the numarray records module
@@ -1161,6 +920,7 @@
         if (len <= 0) {
             goto fail;
         }
+#if 0
         /* check for datetime format */
         if ((len > 1) && _check_for_datetime(type, len)) {
             *at = _convert_from_datetime(obj);
@@ -1169,6 +929,7 @@
             }
             return PY_FAIL;
         }
+#endif
         /* check for commas present or first (or second) element a digit */
         if (_check_for_commastring(type, len)) {
             *at = _convert_from_commastring(obj, 0);
@@ -1415,47 +1176,6 @@
                          self->subarray->shape);
 }
 
-static PyObject *
-_append_to_datetime_typestr(PyArray_Descr *self, PyObject *ret)
-{
-    PyObject *tmp;
-    PyObject *res;
-    int num, den, events;
-    char *basestr;
-    PyArray_DatetimeMetaData *dt_data;
-
-    /* This shouldn't happen */
-    if (self->metadata == NULL) return ret;
-
-    tmp = PyDict_GetItemString(self->metadata, NPY_METADATA_DTSTR);
-    dt_data = PyCObject_AsVoidPtr(tmp);
-    num = dt_data->num;
-    den = dt_data->den;
-    events = dt_data->events;
-    basestr = _datetime_strings[dt_data->base];
-
-    if (num == 1) {
-        tmp = PyString_FromString(basestr);
-    }
-    else {
-        tmp = PyString_FromFormat("%d%s", num, basestr);
-    }
-    if (den != 1) {
-        res = PyString_FromFormat("/%d", den);
-        PyString_ConcatAndDel(&tmp, res);
-    }
-
-    res = PyString_FromString("[");
-    PyString_ConcatAndDel(&res, tmp);
-    PyString_ConcatAndDel(&res, PyString_FromString("]"));
-    if (events != 1) {
-        tmp = PyString_FromFormat("//%d", events);
-        PyString_ConcatAndDel(&res, tmp);
-    }
-    PyString_ConcatAndDel(&ret, res);
-    return ret;
-}
-
 NPY_NO_EXPORT PyObject *
 arraydescr_protocol_typestr_get(PyArray_Descr *self)
 {
@@ -1475,9 +1195,6 @@
     }
 
     ret = PyString_FromFormat("%c%c%d", endian, basic_, size);
-    if (PyDataType_ISDATETIME(self)) {
-        ret = _append_to_datetime_typestr(self, ret);
-    }
     return ret;
 
 }
@@ -1518,9 +1235,6 @@
         p = PyString_FromFormat("%d", self->elsize * 8);
         PyString_ConcatAndDel(&res, p);
     }
-    if (PyDataType_ISDATETIME(self)) {
-        res = _append_to_datetime_typestr(self, res);
-    }
     return res;
 }
 
@@ -1870,30 +1584,6 @@
     return (PyObject *)conv;
 }
 
-/* Return a tuple of (cleaned metadata dictionary,
-                      tuple with (str, num, events))
-*/
-static PyObject *
-_get_pickleabletype_from_metadata(PyObject *metadata)
-{
-    PyObject *newdict;
-    PyObject *newtup, *dt_tuple;
-    PyObject *cobj;
-
-    newdict = PyDict_Copy(metadata);
-    PyDict_DelItemString(newdict, NPY_METADATA_DTSTR);
-    newtup = PyTuple_New(2);
-    PyTuple_SET_ITEM(newtup, 0, newdict);
-
-    cobj = PyDict_GetItemString(metadata, NPY_METADATA_DTSTR);
-    dt_tuple = _get_datetime_tuple_from_cobj(cobj);
-
-    PyTuple_SET_ITEM(newtup, 1, dt_tuple);
-
-    return newtup;
-}
-
-
 /* return a tuple of (callable object, args, state). */
 static PyObject *
 arraydescr_reduce(PyArray_Descr *self, PyObject *NPY_UNUSED(args))
@@ -1981,18 +1671,8 @@
     PyTuple_SET_ITEM(state, 6, PyInt_FromLong(alignment));
     PyTuple_SET_ITEM(state, 7, PyInt_FromLong(self->hasobject));
     if (self->metadata) {
-        if (PyDataType_ISDATETIME(self)) {
-            PyObject *newobj;
-            /* Handle CObject in NPY_METADATA_DTSTR key separately */
-            /* newobj is a tuple of cleaned metadata dictionary
-               and tuple of date_time info (str, num, den, events) */
-            newobj = _get_pickleabletype_from_metadata(self->metadata);
-            PyTuple_SET_ITEM(state, 8, newobj);
-        }
-        else {
-            Py_INCREF(self->metadata);
-            PyTuple_SET_ITEM(state, 8, self->metadata);
-        }
+        Py_INCREF(self->metadata);
+        PyTuple_SET_ITEM(state, 8, self->metadata);
     }
     else {
         PyTuple_SET_ITEM(state, 8, Py_None);
@@ -2179,22 +1859,12 @@
     }
 
     Py_XDECREF(self->metadata);
-    if (PyDataType_ISDATETIME(self) && (metadata != Py_None) && (metadata != NULL)) {
-        PyObject *cobj;
-        self->metadata = PyTuple_GET_ITEM(metadata, 0);
-        Py_INCREF(self->metadata);
-        cobj = _convert_datetime_tuple_to_cobj(PyTuple_GET_ITEM(metadata, 1));
-        PyDict_SetItemString(self->metadata, NPY_METADATA_DTSTR, cobj);
-        Py_DECREF(cobj);
-    }
-    else {
-        /* We have a borrowed reference to metadata so no need
-           to alter reference count
-        */
-        if (metadata == Py_None) metadata = NULL;
-        self->metadata = metadata;
-        Py_XINCREF(metadata);
-    }
+    /* We have a borrowed reference to metadata so no need
+       to alter reference count
+    */
+    if (metadata == Py_None) metadata = NULL;
+    self->metadata = metadata;
+    Py_XINCREF(metadata);
 
     Py_INCREF(Py_None);
     return Py_None;

Modified: branches/1.4.x/numpy/core/src/multiarray/multiarraymodule.c
===================================================================
--- branches/1.4.x/numpy/core/src/multiarray/multiarraymodule.c	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/src/multiarray/multiarraymodule.c	2010-02-09 06:11:19 UTC (rev 8098)
@@ -1307,34 +1307,6 @@
     return same;
 }
 
-/*
- * compare the metadata for two date-times
- * return 1 if they are the same 
- * or 0 if not
- */
-static int
-_equivalent_units(PyObject *meta1, PyObject *meta2) 
-{
-    PyObject *cobj1, *cobj2;
-    PyArray_DatetimeMetaData *data1, *data2;
-    
-    /* Same meta object */
-    if (meta1 == meta2)
-	return 1;
-    
-    cobj1 = PyDict_GetItemString(meta1, NPY_METADATA_DTSTR);
-    cobj2 = PyDict_GetItemString(meta2, NPY_METADATA_DTSTR);
-    if (cobj1 == cobj2) 
-	return 1;
-    
-    data1 = PyCObject_AsVoidPtr(cobj1);
-    data2 = PyCObject_AsVoidPtr(cobj2);
-    
-    return ((data1->base == data2->base) && (data1->num == data2->num) 
-	    && (data1->den == data2->den) && (data1->events == data2->events));    
-}
-
-
 /*NUMPY_API
  *
  * This function returns true if the two typecodes are
@@ -1359,11 +1331,6 @@
         return ((typenum1 == typenum2) &&
                 _equivalent_fields(typ1->fields, typ2->fields));
     }
-    if (typenum1 == PyArray_DATETIME || typenum1 == PyArray_DATETIME
-	|| typenum2 == PyArray_TIMEDELTA || typenum2 == PyArray_TIMEDELTA) {
-	return ((typenum1 == typenum2) &&
-		_equivalent_units(typ1->metadata, typ2->metadata));
-    }
     return (typ1->kind == typ2->kind);
 }
 
@@ -2839,10 +2806,6 @@
     SINGLE_INHERIT(LongLong, SignedInteger);
 #endif
 
-    SINGLE_INHERIT(TimeInteger, SignedInteger);
-    SINGLE_INHERIT(Datetime, TimeInteger);
-    SINGLE_INHERIT(Timedelta, TimeInteger);
-
     /*
        fprintf(stderr,
         "tp_free = %p, PyObject_Del = %p, int_tp_free = %p, base.tp_free = %p\n",
@@ -2999,10 +2962,6 @@
     PyDict_SetItemString(d, "METADATA_DTSTR", s);
     Py_DECREF(s);
 
-    s = PyCObject_FromVoidPtr((void *)_datetime_strings, NULL);
-    PyDict_SetItemString(d, "DATETIMEUNITS", s);
-    Py_DECREF(s);
-
 #define ADDCONST(NAME)                          \
     s = PyInt_FromLong(NPY_##NAME);             \
     PyDict_SetItemString(d, #NAME, s);          \

Modified: branches/1.4.x/numpy/core/src/multiarray/scalarapi.c
===================================================================
--- branches/1.4.x/numpy/core/src/multiarray/scalarapi.c	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/src/multiarray/scalarapi.c	2010-02-09 06:11:19 UTC (rev 8098)
@@ -60,8 +60,6 @@
         CASE(CDOUBLE, CDouble);
         CASE(CLONGDOUBLE, CLongDouble);
         CASE(OBJECT, Object);
-        CASE(DATETIME, Datetime);
-        CASE(TIMEDELTA, Timedelta);
 #undef CASE
         case NPY_STRING:
             return (void *)PyString_AS_STRING(scalar);
@@ -89,10 +87,6 @@
                 _IFCASE(Int);
                 _IFCASE(Long);
                 _IFCASE(LongLong);
-                if _CHK(TimeInteger) {
-                    _IFCASE(Datetime);
-                    _IFCASE(Timedelta);
-                }
             }
             else {
                 /* Unsigned Integer */
@@ -513,40 +507,6 @@
         return descr;
     }
     
-    if (PyArray_IsScalar(sc, TimeInteger)) {
-	PyObject *cobj;
-	PyArray_DatetimeMetaData *dt_data;
-	
-	dt_data = _pya_malloc(sizeof(PyArray_DatetimeMetaData));
-	
-	if (PyArray_IsScalar(sc, Datetime)) {
-	    descr = PyArray_DescrNewFromType(PyArray_DATETIME);
-	    memcpy(dt_data, &((PyDatetimeScalarObject *)sc)->obmeta,
-		   sizeof(PyArray_DatetimeMetaData));
-	}
-	else {/* Timedelta */
-	    descr = PyArray_DescrNewFromType(PyArray_TIMEDELTA);
-	    memcpy(dt_data, &((PyTimedeltaScalarObject *)sc)->obmeta, 
-		   sizeof(PyArray_DatetimeMetaData));
-	}
-        cobj = PyCObject_FromVoidPtr((void *)dt_data, _pya_free);
-	
-	/* Add correct meta-data to the data-type */
-
-	if (descr == NULL) {Py_DECREF(cobj); return NULL;}
-
-	Py_XDECREF(descr->metadata);
-	if ((descr->metadata = PyDict_New())== NULL) {
-	    Py_DECREF(descr); Py_DECREF(cobj); return NULL;
-	}
-	
-	/* Assume this sets a new reference to cobj */
-	PyDict_SetItemString(descr->metadata, NPY_METADATA_DTSTR, cobj);
-	Py_DECREF(cobj);
-	
-	return descr;
-    }
-
     descr = PyArray_DescrFromTypeObject((PyObject *)sc->ob_type);
     if (descr->elsize == 0) {
         PyArray_DESCR_REPLACE(descr);
@@ -647,16 +607,6 @@
     if (obj == NULL) {
         return NULL;
     }
-    if PyTypeNum_ISDATETIME(type_num) {
-        /* We need to copy the resolution information over to the scalar */
-        /* Get the void * from the metadata dictionary */
-        PyObject *cobj; 
-        PyArray_DatetimeMetaData *dt_data;
-        cobj = PyDict_GetItemString(descr->metadata, NPY_METADATA_DTSTR);
-        dt_data = PyCObject_AsVoidPtr(cobj);
-        memcpy(&(((PyDatetimeScalarObject *)obj)->obmeta), dt_data,
-               sizeof(PyArray_DatetimeMetaData));       
-    }
     if PyTypeNum_ISFLEXIBLE(type_num) {
             if (type_num == PyArray_STRING) {
                 destptr = PyString_AS_STRING(obj);

Modified: branches/1.4.x/numpy/core/src/multiarray/scalartypes.c.src
===================================================================
--- branches/1.4.x/numpy/core/src/multiarray/scalartypes.c.src	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/src/multiarray/scalartypes.c.src	2010-02-09 06:11:19 UTC (rev 8098)
@@ -1917,12 +1917,12 @@
 /**begin repeat
  * #name = byte, short, int, long, longlong, ubyte, ushort, uint, ulong,
  *         ulonglong, float, double, longdouble, cfloat, cdouble, clongdouble,
- *         string, unicode, object, datetime, timedelta#
+ *         string, unicode, object#
  * #TYPE = BYTE, SHORT, INT, LONG, LONGLONG, UBYTE, USHORT, UINT, ULONG,
  *         ULONGLONG, FLOAT, DOUBLE, LONGDOUBLE, CFLOAT, CDOUBLE, CLONGDOUBLE,
- *         STRING, UNICODE, OBJECT, DATETIME, TIMEDELTA#
- * #work = 0,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,z,z,0,0,0#
- * #default = 0*16,1*2,2,0*2#
+ *         STRING, UNICODE, OBJECT#
+ * #work = 0,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0,z,z,0#
+ * #default = 0*16,1*2,2#
  */
 
 #define _NPY_UNUSED2_1
@@ -2324,50 +2324,6 @@
 
 #endif
 
-
-/**begin repeat
- * #lname=datetime, timedelta#
- * #name=Datetime,Timedelta#
- */
-#if SIZEOF_LONG==SIZEOF_DATETIME
-static long
- at lname@_arrtype_hash(PyObject *obj)
-{
-    long x = (long)(((Py at name@ScalarObject *)obj)->obval);
-    if (x == -1) {
-        x = -2;
-    }
-    return x;
-}
-#elif SIZEOF_LONGLONG==SIZEOF_DATETIME
-static long
- at lname@_arrtype_hash(PyObject *obj)
-{
-    long y;
-    longlong x = (((Py at name@ScalarObject *)obj)->obval);
-
-    if ((x <= LONG_MAX)) {
-        y = (long) x;
-    }
-    else {
-        union Mask {
-            long hashvals[2];
-            longlong v;
-        } both;
-
-        both.v = x;
-        y = both.hashvals[0] + (1000003)*both.hashvals[1];
-    }
-    if (y == -1) {
-        y = -2;
-    }
-    return y;
-}
-#endif
-/**end repeat**/
-
-
-
 /* Wrong thing to do for longdouble, but....*/
 
 /**begin repeat
@@ -2791,10 +2747,9 @@
 
 /**begin repeat
  * #NAME = Byte, Short, Int, Long, LongLong, UByte, UShort, UInt, ULong,
- *         ULongLong, Float, Double, LongDouble, Datetime, Timedelta#
- * #name = int*5, uint*5, float*3, datetime, timedelta#
- * #CNAME = (CHAR, SHORT, INT, LONG, LONGLONG)*2, FLOAT, DOUBLE, LONGDOUBLE,
- *          DATETIME, TIMEDELTA#
+ *         ULongLong, Float, Double, LongDouble#
+ * #name = int*5, uint*5, float*3#
+ * #CNAME = (CHAR, SHORT, INT, LONG, LONGLONG)*2, FLOAT, DOUBLE, LONGDOUBLE#
  */
 #if BITSOF_ at CNAME@ == 8
 #define _THIS_SIZE "8"
@@ -3046,10 +3001,10 @@
     /**begin repeat
      * #name = bool, byte, short, int, long, longlong, ubyte, ushort, uint,
      *         ulong, ulonglong, float, double, longdouble, cfloat, cdouble,
-     *         clongdouble, string, unicode, void, object, datetime, timedelta#
+     *         clongdouble, string, unicode, void, object#
      * #NAME = Bool, Byte, Short, Int, Long, LongLong, UByte, UShort, UInt,
      *         ULong, ULongLong, Float, Double, LongDouble, CFloat, CDouble,
-     *         CLongDouble, String, Unicode, Void, Object, Datetime, Timedelta#
+     *         CLongDouble, String, Unicode, Void, Object#
      */
     Py at NAME@ArrType_Type.tp_flags = BASEFLAGS;
     Py at NAME@ArrType_Type.tp_new = @name at _arrtype_new;
@@ -3058,11 +3013,9 @@
 
     /**begin repeat
      * #name = bool, byte, short, ubyte, ushort, uint, ulong, ulonglong,
-     *         float, longdouble, cfloat, clongdouble, void, object, datetime,
-     *         timedelta#
+     *         float, longdouble, cfloat, clongdouble, void, object#
      * #NAME = Bool, Byte, Short, UByte, UShort, UInt, ULong, ULongLong,
-     *         Float, LongDouble, CFloat, CLongDouble, Void, Object, Datetime,
-     *         Timedelta#
+     *         Float, LongDouble, CFloat, CLongDouble, Void, Object#
      */
     Py at NAME@ArrType_Type.tp_hash = @name at _arrtype_hash;
     /**end repeat**/
@@ -3141,8 +3094,6 @@
     &PyStringArrType_Type,
     &PyUnicodeArrType_Type,
     &PyVoidArrType_Type,
-    &PyDatetimeArrType_Type,
-    &PyTimedeltaArrType_Type
 };
 
 NPY_NO_EXPORT int

Modified: branches/1.4.x/numpy/core/src/multiarray/scalartypes.h
===================================================================
--- branches/1.4.x/numpy/core/src/multiarray/scalartypes.h	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/src/multiarray/scalartypes.h	2010-02-09 06:11:19 UTC (rev 8098)
@@ -16,19 +16,4 @@
 NPY_NO_EXPORT void *
 scalar_value(PyObject *scalar, PyArray_Descr *descr);
 
-/*
- * XXX: those are defined here for 1.4.x only -> they are intended to become
- * public types, and are declared like all other types through the code
- * generator machinery for >= 1.5.0
- */
-#ifdef NPY_ENABLE_SEPARATE_COMPILATION
-extern NPY_NO_EXPORT PyTypeObject PyTimeIntegerArrType_Type;
-extern NPY_NO_EXPORT PyTypeObject PyDatetimeArrType_Type;
-extern NPY_NO_EXPORT PyTypeObject PyTimedeltaArrType_Type;
-#else
-NPY_NO_EXPORT PyTypeObject PyTimeIntegerArrType_Type;
-NPY_NO_EXPORT PyTypeObject PyDatetimeArrType_Type;
-NPY_NO_EXPORT PyTypeObject PyTimedeltaArrType_Type;
 #endif
-
-#endif

Modified: branches/1.4.x/numpy/core/src/umath/loops.h
===================================================================
--- branches/1.4.x/numpy/core/src/umath/loops.h	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/src/umath/loops.h	2010-02-09 06:11:19 UTC (rev 8098)
@@ -2357,177 +2357,31 @@
 
 /*
  *****************************************************************************
- **                            DATETIME LOOPS                               **
- *****************************************************************************
- */
-
-#line 406
-#define DATETIME_fmax DATETIME_maximum
-#define DATETIME_fmin DATETIME_minimum
-
-#line 406
-#define TIMEDELTA_fmax TIMEDELTA_maximum
-#define TIMEDELTA_fmin TIMEDELTA_minimum
-
-
-#line 415
-NPY_NO_EXPORT void
-DATETIME_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-#line 415
-NPY_NO_EXPORT void
-DATETIME_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-#line 415
-NPY_NO_EXPORT void
-DATETIME_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-#line 415
-NPY_NO_EXPORT void
-DATETIME_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-#line 415
-NPY_NO_EXPORT void
-DATETIME_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-#line 415
-NPY_NO_EXPORT void
-DATETIME_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-#line 415
-NPY_NO_EXPORT void
-DATETIME_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_absolute(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-#line 415
-NPY_NO_EXPORT void
-DATETIME_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_logical_and(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-#line 415
-NPY_NO_EXPORT void
-DATETIME_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_logical_not(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-#line 415
-NPY_NO_EXPORT void
-DATETIME_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_logical_or(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-#line 415
-NPY_NO_EXPORT void
-DATETIME_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_logical_xor(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-#line 415
-NPY_NO_EXPORT void
-DATETIME_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_maximum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-#line 415
-NPY_NO_EXPORT void
-DATETIME_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_minimum(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-#line 415
-NPY_NO_EXPORT void
-DATETIME_negative(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_negative(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-#line 415
-NPY_NO_EXPORT void
-DATETIME_ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_ones_like(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-#line 415
-NPY_NO_EXPORT void
-DATETIME_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_sign(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-
-NPY_NO_EXPORT void
-DATETIME_Mm_M_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-DATETIME_mM_M_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-DATETIME_Mm_M_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-DATETIME_MM_m_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_mm_m_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_mm_m_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-/*
- *****************************************************************************
  **                            OBJECT LOOPS                                 **
  *****************************************************************************
  */
 
-#line 450
+#line 407
 NPY_NO_EXPORT void
 OBJECT_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
 
-#line 450
+#line 407
 NPY_NO_EXPORT void
 OBJECT_not_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
 
-#line 450
+#line 407
 NPY_NO_EXPORT void
 OBJECT_greater(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
 
-#line 450
+#line 407
 NPY_NO_EXPORT void
 OBJECT_greater_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
 
-#line 450
+#line 407
 NPY_NO_EXPORT void
 OBJECT_less(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
 
-#line 450
+#line 407
 NPY_NO_EXPORT void
 OBJECT_less_equal(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
 

Modified: branches/1.4.x/numpy/core/src/umath/loops.h.src
===================================================================
--- branches/1.4.x/numpy/core/src/umath/loops.h.src	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/src/umath/loops.h.src	2010-02-09 06:11:19 UTC (rev 8098)
@@ -396,49 +396,6 @@
 
 /*
  *****************************************************************************
- **                            DATETIME LOOPS                               **
- *****************************************************************************
- */
-
-/**begin repeat
- * #TYPE = DATETIME, TIMEDELTA#
- */
-#define @TYPE at _fmax @TYPE at _maximum
-#define @TYPE at _fmin @TYPE at _minimum
-/**end repeat**/
-
-/**begin repeat
- * #kind = equal, not_equal, greater, greater_equal, less, less_equal,
- *      absolute, logical_and, logical_not, logical_or, logical_xor, maximum,
- *      minimum, negative, ones_like, sign#
- */
-NPY_NO_EXPORT void
-DATETIME_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_ at kind@(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-/**end repeat**/
-
-NPY_NO_EXPORT void
-DATETIME_Mm_M_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-DATETIME_mM_M_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-DATETIME_Mm_M_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-DATETIME_MM_m_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_mm_m_add(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-NPY_NO_EXPORT void
-TIMEDELTA_mm_m_subtract(char **args, intp *dimensions, intp *steps, void *NPY_UNUSED(func));
-
-/*
- *****************************************************************************
  **                            OBJECT LOOPS                                 **
  *****************************************************************************
  */

Modified: branches/1.4.x/numpy/core/src/umath/ufunc_object.c
===================================================================
--- branches/1.4.x/numpy/core/src/umath/ufunc_object.c	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/src/umath/ufunc_object.c	2010-02-09 06:11:19 UTC (rev 8098)
@@ -213,9 +213,6 @@
     case PyArray_INT:
     case PyArray_LONG:
     case PyArray_LONGLONG:
-    case PyArray_DATETIME:
-    case PyArray_TIMEDELTA:
-        return PyArray_BYTE;
     /* case PyArray_UBYTE */
     case PyArray_USHORT:
     case PyArray_UINT:
@@ -1539,13 +1536,6 @@
                     || (arg_types[i] == PyArray_OBJECT))) {
             loop->obj = UFUNC_OBJ_ISOBJECT|UFUNC_OBJ_NEEDS_API;
         }
-        if (!(loop->obj & UFUNC_OBJ_NEEDS_API)
-                && ((mps[i]->descr->type_num == PyArray_DATETIME)
-                    || (mps[i]->descr->type_num == PyArray_TIMEDELTA)
-                    || (arg_types[i] == PyArray_DATETIME)
-                    || (arg_types[i] == PyArray_TIMEDELTA))) {
-            loop->obj = UFUNC_OBJ_NEEDS_API;
-        }
     }
 
     if (self->core_enabled && (loop->obj & UFUNC_OBJ_ISOBJECT)) {
@@ -2504,13 +2494,6 @@
     if (otype == PyArray_OBJECT || aar->descr->type_num == PyArray_OBJECT) {
         loop->obj = UFUNC_OBJ_ISOBJECT | UFUNC_OBJ_NEEDS_API;
     }
-    else if ((otype == PyArray_DATETIME)
-            || (aar->descr->type_num == PyArray_DATETIME)
-            || (otype == PyArray_TIMEDELTA)
-            || (aar->descr->type_num == PyArray_TIMEDELTA))
-    {
-        loop->obj = UFUNC_OBJ_NEEDS_API;
-    }
     else {
         loop->obj = 0;
     }

Deleted: branches/1.4.x/numpy/core/tests/test_datetime.py
===================================================================
--- branches/1.4.x/numpy/core/tests/test_datetime.py	2010-02-09 06:10:41 UTC (rev 8097)
+++ branches/1.4.x/numpy/core/tests/test_datetime.py	2010-02-09 06:11:19 UTC (rev 8098)
@@ -1,59 +0,0 @@
-from os import path
-import numpy as np
-from numpy.testing import *
-
-class TestDateTime(TestCase):
-    def test_creation(self):
-        for unit in ['Y', 'M', 'W', 'B', 'D',
-                     'h', 'm', 's', 'ms', 'us',
-                     'ns', 'ps', 'fs', 'as']:            
-            dt1 = np.dtype('M8[750%s]'%unit)
-            assert dt1 == np.dtype('datetime64[750%s]' % unit)
-            dt2 = np.dtype('m8[%s]' % unit)
-            assert dt2 == np.dtype('timedelta64[%s]' % unit)
-        
-    def test_divisor_conversion_year(self):
-        assert np.dtype('M8[Y/4]') == np.dtype('M8[3M]')
-        assert np.dtype('M8[Y/13]') == np.dtype('M8[4W]')
-        assert np.dtype('M8[3Y/73]') == np.dtype('M8[15D]')
-
-    def test_divisor_conversion_month(self):
-        assert np.dtype('M8[M/2]') == np.dtype('M8[2W]')
-        assert np.dtype('M8[M/15]') == np.dtype('M8[2D]')
-        assert np.dtype('M8[3M/40]') == np.dtype('M8[54h]')
-
-    def test_divisor_conversion_week(self):
-        assert np.dtype('m8[W/5]') == np.dtype('m8[B]')
-        assert np.dtype('m8[W/7]') == np.dtype('m8[D]')
-        assert np.dtype('m8[3W/14]') == np.dtype('m8[36h]')
-        assert np.dtype('m8[5W/140]') == np.dtype('m8[360m]') 
-        
-    def test_divisor_conversion_bday(self):
-        assert np.dtype('M8[B/12]') == np.dtype('M8[2h]')
-        assert np.dtype('M8[B/120]') == np.dtype('M8[12m]')
-        assert np.dtype('M8[3B/960]') == np.dtype('M8[270s]')
-
-    def test_divisor_conversion_day(self):
-        assert np.dtype('M8[D/12]') == np.dtype('M8[2h]')
-        assert np.dtype('M8[D/120]') == np.dtype('M8[12m]')
-        assert np.dtype('M8[3D/960]') == np.dtype('M8[270s]')
-
-    def test_divisor_conversion_hour(self):
-        assert np.dtype('m8[h/30]') == np.dtype('m8[2m]')
-        assert np.dtype('m8[3h/300]') == np.dtype('m8[36s]')
-
-    def test_divisor_conversion_minute(self):
-        assert np.dtype('m8[m/30]') == np.dtype('m8[2s]')
-        assert np.dtype('m8[3m/300]') == np.dtype('m8[600ms]')
-
-    def test_divisor_conversion_second(self):
-        assert np.dtype('m8[s/100]') == np.dtype('m8[10ms]')
-        assert np.dtype('m8[3s/10000]') == np.dtype('m8[300us]')
-
-    def test_divisor_conversion_fs(self):
-        assert np.dtype('M8[fs/100]') == np.dtype('M8[10as]')
-        self.failUnlessRaises(ValueError, lambda : np.dtype('M8[3fs/10000]'))
-
-    def test_divisor_conversion_as(self):
-        self.failUnlessRaises(ValueError, lambda : np.dtype('M8[as/10]'))
-




More information about the Numpy-svn mailing list