Fix PyDateTime_CheckExact checks as proxy for Timestamp checks in cython files · Issue #25851 · pandas-dev/pandas (original) (raw)

This is a followup to the discussion in #25746.

PyDateTime_CheckExact is being used as a proxy for isinstance(obj, Timestamp) checks for performance reasons. However, if a subclass of the std datetime lib is being used, these checks are not sufficient to determine if an object is a Timestamp or not. Thus a performant replacement must be found.

I have a working fix, but need to do some more performance testing and add proper test cases. If that goes well, I will submit a PR for this.