* Recursively determines the metadata for an NPY_TIMEDELTA dtype. * * Returns 0 on success, -1 on failure. */
| 3685 | * Returns 0 on success, -1 on failure. |
| 3686 | */ |
| 3687 | static int |
| 3688 | find_object_timedelta64_meta(PyObject *obj, PyArray_DatetimeMetaData *meta) |
| 3689 | { |
| 3690 | /* Datetime scalar -> use its metadata */ |
| 3691 | if (PyArray_IsScalar(obj, Timedelta)) { |
| 3692 | PyTimedeltaScalarObject *dts = (PyTimedeltaScalarObject *)obj; |
| 3693 | |
| 3694 | /* Combine it with 'meta' */ |
| 3695 | if (compute_datetime_metadata_greatest_common_divisor(meta, |
| 3696 | &dts->obmeta, meta, 1, 1) < 0) { |
| 3697 | return -1; |
| 3698 | } |
| 3699 | |
| 3700 | return 0; |
| 3701 | } |
| 3702 | /* String -> parse it to find out */ |
| 3703 | else if (PyBytes_Check(obj) || PyUnicode_Check(obj)) { |
| 3704 | /* No timedelta parser yet */ |
| 3705 | return 0; |
| 3706 | } |
| 3707 | /* Python timedelta object -> 'us' */ |
| 3708 | else if (PyDelta_Check(obj)) { |
| 3709 | return delta_checker(meta); |
| 3710 | } |
| 3711 | /* Otherwise ignore it */ |
| 3712 | else { |
| 3713 | return 0; |
| 3714 | } |
| 3715 | } |
| 3716 | |
| 3717 | /* |
| 3718 | * Examines all the objects in the given Python object by |
no test coverage detected