[docs] ssl.cert_time_to_seconds() returns wrong results if local timezone is not UTC (issue 19940)

4kir4.1i at gmail.com 4kir4.1i at gmail.com
Sun Mar 23 22:53:27 CET 2014


Reviewers: AntoinePitrou,

Message:
Thank you for the review. Sorry for the delay. I have not received
e-mail notification.

I've updated the patch.


http://bugs.python.org/review/19940/diff/11142/Doc/library/ssl.rst
File Doc/library/ssl.rst (right):

http://bugs.python.org/review/19940/diff/11142/Doc/library/ssl.rst#newcode379
Doc/library/ssl.rst:379: "notBefore" or "notAfter" dates must use GMT
(:rfc:`3280`).
On 2014/02/27 20:44:43, AntoinePitrou wrote:
> It seems RFC 3280 was superseded by RFC 5280?

Yes. I've updated the rfc number

http://bugs.python.org/review/19940/diff/11142/Lib/test/test_ssl.py
File Lib/test/test_ssl.py (right):

http://bugs.python.org/review/19940/diff/11142/Lib/test/test_ssl.py#newcode654
Lib/test/test_ssl.py:654: class UtilityTests(unittest.TestCase):
On 2014/02/27 20:44:43, AntoinePitrou wrote:
> The tests can go in BasicSocketTests, which already has many tests for
> module-level utilities.

I've moved the tests back to BasicSocketTests

http://bugs.python.org/review/19940/diff/11142/Lib/test/test_ssl.py#newcode656
Lib/test/test_ssl.py:656: def good(self, timestring, timestamp):
On 2014/02/27 20:44:43, AntoinePitrou wrote:
> As a matter of naming, I would prefer something more explicit than
"good".
> "cert_time_ok" perhaps?

I've renamed the method

http://bugs.python.org/review/19940/diff/11142/Lib/test/test_ssl.py#newcode659
Lib/test/test_ssl.py:659: def bad(self, timestring):
On 2014/02/27 20:44:43, AntoinePitrou wrote:
> Same here.

I've renamed it to `cert_time_fail()`

http://bugs.python.org/review/19940/diff/11142/Lib/test/test_ssl.py#newcode663
Lib/test/test_ssl.py:663: @unittest.skipUnless(utc_offset(),
On 2014/02/27 20:44:43, AntoinePitrou wrote:
> I don't understand the skip. The test will work even if the local time
is UTC.
> (be assured that most computers running the tests, even our buildbots,
won't be
> set on an UTC timezone anyway)

The skip is a remainder that the bug is triggered iff utc offset is
non-zero. Otherwise it can be removed completely.

http://bugs.python.org/review/19940/diff/11142/Lib/test/test_ssl.py#newcode705
Lib/test/test_ssl.py:705: locale.setlocale(locale.LC_TIME, 'pl_PL.utf8')
On 2014/02/27 20:44:43, AntoinePitrou wrote:
> To maximize chances that the test is run, you could simply set the
locale to
> locale.getdefaultlocale().
> Below, you can use the result of `time.strftime('%b %d %H:%M:%S %Y
GMT')`
> instead of the hardcoded Polish time string.

`pl_PL` was used to make sure that `local_february_name()` is not
`'Feb'`. Otherwise the second skip is triggered. 

I've changed the code to use `LC_ALL, ''`



Please review this at http://bugs.python.org/review/19940/

Affected files:
  Doc/library/ssl.rst
  Lib/ssl.py
  Lib/test/test_ssl.py




More information about the docs mailing list