Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This moves `tzfile` into its own submodule containing what is effectively a backport of the pure python implementation of `zoneinfo.ZoneInfo`, but with the semantics of a `dateutil.tz.tzfile` object. The major differences from zoneinfo are: 1. All caching logic is implemented in `tz.gettz` rather than in `tz.tzfile`. 2. `tzfile` objects are pickled by value, not by reference to the IANA key. 3. `tzfile` has equality-by-value semantics, whereas `zoneinfo` has equality-by-identity semantics. This does change the internal implementation details of the class. It also fixes at least two bugs: 1. It adds support for V2 and V3 files, which also solves the 2038 problem (and the "slim zoneinfo" problem). 2. Prior to this change, `dateutil` did not use the `fold` attribute during gaps (only during folds), in violation of PEP 495. This fixes that, but that does change the semantics of imaginary times a bit (and thus may affect some mechanisms for detecting imaginary times). This is mostly a code dump with compatibility adjustments. It's quite possible that we'll want to refactor, particularly with respect to the way POSIX strings are handled. Theoretically `tzfile` could fall back to a `tz.tzstr` or some other `tz.tzrange`, or we could refactor `tzstr` and `tzrange` in terms of _CalendarOffset, _DayOffset and _TZStr (or both, by refactoring the internal logic of `tzstr` and/or `tzrange`).
- Loading branch information