3
#include <numpy/arrayobject.h>
6
static PyObject* isAllDates(PyObject *self, PyObject *args) {
10
PyArrayIterObject *iter;
14
if (PyArg_ParseTuple(args, "O", &input)) {
15
if (!PyArray_Check(input)) {
16
PyErr_SetString(PyExc_RuntimeError, "Input was not ndarray!");
20
long size = PyArray_SIZE(input);
26
iter = (PyArrayIterObject *) PyArray_IterNew(input);
28
while (iter->index < iter->size) {
29
obj = PyArray_GETITEM(input, (void *) iter->dataptr);
30
if (!PyDateTime_Check(obj)) {
38
PyArray_ITER_NEXT(iter);
47
static PyMethodDef tdatesMethods[] =
49
{ "isAllDates", isAllDates, METH_VARARGS, NULL },
50
{ NULL, NULL, 0, NULL},
53
PyMODINIT_FUNC inittdates(void)
55
(void) Py_InitModule("tdates", tdatesMethods);