@@ -1831,6 +1831,29 @@ get(FAMObject *self, PyObject *key, PyObject *missing) {
18311831 } \
18321832} \
18331833
1834+ # define GET_ALL_DT64 (npy_type_src , npy_type_dst , kat , lookup_func , hash_func ) \
1835+ { \
1836+ npy_type_dst v; \
1837+ for (; i < key_size; i++) { \
1838+ v = *(npy_type_src*)PyArray_GETPTR1(key_array, i); \
1839+ table_pos = lookup_func(self, v, hash_func(v), kat); \
1840+ if (table_pos < 0 || (self->table[table_pos].hash == -1)) { \
1841+ Py_DECREF(array); \
1842+ if (PyErr_Occurred()) { \
1843+ return NULL; \
1844+ } \
1845+ k = PyArray_ToScalar(&v, key_array); \
1846+ if (k == NULL) { \
1847+ return NULL; \
1848+ } \
1849+ PyErr_SetObject(PyExc_KeyError, k); \
1850+ Py_DECREF(k); \
1851+ return NULL; \
1852+ } \
1853+ b[i] = (npy_int64)self->table[table_pos].keys_pos; \
1854+ } \
1855+ } \
1856+
18341857# define GET_ALL_FLEXIBLE (char_type , get_end_func , lookup_func , hash_func , to_obj_func ) \
18351858{ \
18361859 char_type* v; \
@@ -1950,14 +1973,15 @@ fam_get_all(FAMObject *self, PyObject *key) {
19501973 case NPY_STRING :
19511974 GET_ALL_FLEXIBLE (char , char_get_end_p , lookup_hash_string , string_to_hash , PyBytes_FromStringAndSize );
19521975 break ;
1953- case NPY_DATETIME :
1976+ case NPY_DATETIME : {
19541977 NPY_DATETIMEUNIT key_unit = dt_unit_from_array (key_array );
19551978 if (!kat_is_datetime_unit (self -> keys_array_type , key_unit )) {
19561979 Py_DECREF (array );
19571980 return NULL ;
19581981 }
1959- GET_ALL_SCALARS (npy_int64 , npy_int64 , KAT_INT64 , lookup_hash_int , int_to_hash , PyLong_FromLongLong , );
1982+ GET_ALL_DT64 (npy_int64 , npy_int64 , KAT_INT64 , lookup_hash_int , int_to_hash );
19601983 break ;
1984+ }
19611985 }
19621986 }
19631987 else {
0 commit comments