pytz._FixedOffsetdoes define a localize() method, but it also explicitly setszone = None. (I'm not familiar enough with pytz, or datetime.tzinfo, conventions to have anything useful to say about whether this is surprising.)
FWIW, pendulum.UTC.convert() does handle pytz._FixedOffset properly. Unsure whether the fix is to reuse that same logic in _safe_timezone()?
Linux-6.6.12-linuxkit-aarch64-with-glibc2.36
3.0.0
Issue
pendulum.instance()
errors if passed adatetime.datetime
wheretzinfo
is apytz._FixedOffset()
instance, e.g.The error seems to originate here: https://github.com/sdispater/pendulum/blob/3e3fec6a5b66759078c5ae39c736ca95b78adbef/src/pendulum/__init__.py#L110-L111
pytz._FixedOffset
does define alocalize()
method, but it also explicitly setszone = None
. (I'm not familiar enough withpytz
, ordatetime.tzinfo
, conventions to have anything useful to say about whether this is surprising.)FWIW,
pendulum.UTC.convert()
does handlepytz._FixedOffset
properly. Unsure whether the fix is to reuse that same logic in_safe_timezone()
?Also, https://github.com/sdispater/pendulum/pull/158 did add some logic to handle
pytz
offsets, but it appears test cases usingpytz.FixedOffset
instances might have been removed?