Re: [pyderasn-devel] [Bug] UTCTime with offset-aware datetimes fails equality check

From: Sergey Matveev <stargrave_at_domain.hidden>
Date: Mon, 13 Apr 2020 17:39:07 +0300
Message-ID: <20200413143907.GA23548_at_domain.hidden>

*** Nikolay Ivanov [2020-04-13 16:06]:
>dt = datetime(1990, 1, 1, 0, 0, tzinfo=tzutc())

PyDERASN has never been aware of timezones in datetimes. It is just
blind to them when encoding. However that is not explicitly mentioned in
documentation and I will fix it.

>ut == nut

Indeed one of them contains original datetime object (with tzinfo set)
and other is decoded one, without any timezone information. I think that
the best thing to do is to explicitly .replace(tzinfo=None) for
initialized datetimes in *Time objects. I will fix it (with
documentation above) in the next release. Or maybe raise an error if
someone uses timezone-away datetime objects, forcing him to make them
neutral? What do you think?

Anyway, if you want to use tzinfo-set objects, then you have to write
your own wrappers. At least DER encoding works only with UTC time.

Sergey Matveev (
OpenPGP: CF60 E89A 5923 1E76 E263  6422 AE1A 8109 E498 57EF

Received on 2020-04-13 14:39:07 UTC

This archive was generated by hypermail 2.4.0 : 2021-02-19 09:13:29 UTC