public inbox for pyderasn-devel@lists.cypherpunks.ru
Atom feed
From: Sergey Matveev <stargrave@stargrave•org>
To: pyderasn-devel@lists.cypherpunks.ru
Subject: Re: [pyderasn-devel] [Bug] UTCTime with offset-aware datetimes fails equality check
Date: Mon, 13 Apr 2020 17:39:07 +0300	[thread overview]
Message-ID: <20200413143907.GA23548@stargrave.org> (raw)
In-Reply-To: <c2c36056-8910-509f-c4f7-b7d1f104b8b1@rnd.stcnet.ru>

[-- Attachment #1: Type: text/plain, Size: 994 bytes --]

Greetings!

*** 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 (http://www.stargrave.org/)
OpenPGP: CF60 E89A 5923 1E76 E263  6422 AE1A 8109 E498 57EF

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2020-04-13 14:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-13 13:06 [pyderasn-devel] [Bug] UTCTime with offset-aware datetimes fails equality check Nikolay Ivanov
2020-04-13 14:39 ` Sergey Matveev [this message]