<div dir="ltr"><div>The inability to compare naive and aware datetimes is an incompatibility.  It is also exactly the reason you want these to be aware, of course. :)<br><br></div>I suggest this is worth doing but worth doing in a way that's backwards compatible.  Introduce a new API for getting the aware datetime and deprecate the old one?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 25, 2015 at 2:04 PM, Donald Stufft <span dir="ltr"><<a href="mailto:donald@stufft.io" target="_blank">donald@stufft.io</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>This would be a backwards incompatible change FWIW because you can’t compare a naive datetime against an aware datetime.</div><div><div class="h5"><br><div><blockquote type="cite"><div>On Nov 25, 2015, at 1:56 PM, Paul Kehrer <<a href="mailto:paul.l.kehrer@gmail.com" target="_blank">paul.l.kehrer@gmail.com</a>> wrote:</div><br><div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px">I definitely can't claim to be an expert on tzinfo in Python, but if we can define our own UTC timezone and have it be compatible with py3 UTC objects that seems reasonable. Are there any surprises we should be aware of?</div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px"><br></div><div style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px">-Paul</div><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><p style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">On November 25, 2015 at 11:27:27 AM, Erik Trauschke (<a href="mailto:erik.trauschke@gmail.com" target="_blank">erik.trauschke@gmail.com</a>) wrote:</p><blockquote type="cite" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span><div><div></div><div>As I see it this would be good practice since the timezone is properly<br>defined. I stumbled over it because the code I'm porting asserts that<br>the times we get are UTC so they can be compared correctly to the<br>current time.<br><br>I guess you could just refer to the documentation but at the moment I<br>don't think it is explicitly mentioned anyway. It just takes the<br>guesswork out.<br><br>Erik<br><br>On Wed, Nov 25, 2015 at 8:39 AM, Paul Kehrer <<a href="mailto:paul.l.kehrer@gmail.com" target="_blank">paul.l.kehrer@gmail.com</a>> wrote:<br>> The documentation states that these are naïve datetimes representing UTC,<br>> but it is true that you can't tell by introspecting the object itself. Do<br>> you see a significant advantage to attaching an explicit timezone to them<br>> outside of being able to introspect the return value in a REPL and see that<br>> it's UTC?<br>><br>> -Paul<br>><br>> On November 25, 2015 at 9:57:40 AM, Erik Trauschke<br>> (<a href="mailto:erik.trauschke@gmail.com" target="_blank">erik.trauschke@gmail.com</a>) wrote:<br>><br>> I noticed that when ever we return datetime objects which come out of<br>> backend.py`_parse_asn1_time(), they don't have a tzinfo attached.<br>><br>> Afaik, these values should always be UTC but for someone consuming<br>> just the result of not_valid_before, etc. that might not be clear. I<br>> think it should be possible to add this to _parse_asn1_time() so that<br>> we indicate that these are UTC times.<br>><br>> I know it's a bit painful in Python <3.2 because we have to implement<br>> the tzinfo class ourself but it's also not that much code.<br>><br>> Erik<br>> _______________________________________________<br>> Cryptography-dev mailing list<br>> <a href="mailto:Cryptography-dev@python.org" target="_blank">Cryptography-dev@python.org</a><br>> <a href="https://mail.python.org/mailman/listinfo/cryptography-dev" target="_blank">https://mail.python.org/mailman/listinfo/cryptography-dev</a><br>><br>><br>> _______________________________________________<br>> Cryptography-dev mailing list<br>> <a href="mailto:Cryptography-dev@python.org" target="_blank">Cryptography-dev@python.org</a><br>> <a href="https://mail.python.org/mailman/listinfo/cryptography-dev" target="_blank">https://mail.python.org/mailman/listinfo/cryptography-dev</a><br>><br>_______________________________________________<br>Cryptography-dev mailing list<br><a href="mailto:Cryptography-dev@python.org" target="_blank">Cryptography-dev@python.org</a><br><a href="https://mail.python.org/mailman/listinfo/cryptography-dev" target="_blank">https://mail.python.org/mailman/listinfo/cryptography-dev</a><br></div></div></span></blockquote><span style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">_______________________________________________</span><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Cryptography-dev mailing list</span><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:Cryptography-dev@python.org" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">Cryptography-dev@python.org</a><br style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="https://mail.python.org/mailman/listinfo/cryptography-dev" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://mail.python.org/mailman/listinfo/cryptography-dev</a></div></blockquote></div><br></div></div><div>
<br>-----------------<br>Donald Stufft<br>PGP: 0x6E3CBCE93372DCFA // 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

</div>
<br></div><br>_______________________________________________<br>
Cryptography-dev mailing list<br>
<a href="mailto:Cryptography-dev@python.org">Cryptography-dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/cryptography-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/cryptography-dev</a><br>
<br></blockquote></div><br></div>