[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,

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

I've updated the patch.

File Doc/library/ssl.rst (right):

Doc/library/ssl.rst:379: "notBefore" or "notAfter" dates must use GMT
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

File Lib/test/test_ssl.py (right):

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

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
> "cert_time_ok" perhaps?

I've renamed the method

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()`

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.

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
> 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:

More information about the docs mailing list