bpo-28602: [WIP] Add fold support to fromutc by pganssle · Pull Request #7425 · python/cpython (original) (raw)

This is an example implementation of generic fold support in datetime.fromutc, for purposes of discussion. The idea here is that so long as utcoffset - dst is constant (as is the fundamental assumption of the current fromutc implementation) and the utcoffset and dst implementations respect the fold parameter, this will always set the fold parameter correctly in fromutc.

This needs more extensive tests and a pure Python implementation (plus I don't think I was amazingly careful about the reference counts), but the overall outline is there. It's basically a port of the current base dateutil implementation.

See GH-72788.

https://bugs.python.org/issue28602