Fix accidental loss-of-precision for to_datetime(str, unit=...) by QuLogic · Pull Request #57548 · pandas-dev/pandas (original) (raw)

As noted, cast_from_unit takes an object, so that doesn't seem to save anything. Here's the diff of the generated code when you add the type (vs having it commented out since that reduces line number changes in the diff):

--- untyped/pandas/_libs/tslib.pyx.c 2024-02-21 18:27:51.686387390 -0500 +++ typed/pandas/_libs/tslib.pyx.c 2024-02-21 18:24:14.824227898 -0500 @@ -25828,9 +25828,9 @@ int __pyx_v_is_raise; PyArrayObject *__pyx_v_iresult = 0; PyDateTime_TZInfo *__pyx_v_tz = 0;