BUG: Parsing week-freq Periods by jbrockmendel · Pull Request #50803 · pandas-dev/pandas (original) (raw)

@lithomas1 IIRC youve spent some time recently in optimizing this portion of the constructor. I'm open to ideas on optimize this check or do it as the fallback rather than up-front.

The reason it is currently up-front is bc ATM parse_datetime_string_with_reso gets this wrong, bc dateutil gets it wrong. Following #50790, we could move the if dt.tzinfo is not None: check from parse_datetime_string into parse_dateutil, at which point parse_datetime_string_with_reso would raise instead of return something incorrect (at least for some cases, I think others might get through).