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

2014-04-28 Thread akira
akira added the comment: I've updated the patch: - fixed the code example in the documentation to use int instead of float result - removed assertion on the int returned type (float won't lose precision for the practical dates but guaranteeing an integer would be nice) - reworded the scary

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

2014-04-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: Thanks for the updated patch, Akira! I'm gonna take a look right now. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19940 ___

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

2014-04-28 Thread Antoine Pitrou
Antoine Pitrou added the comment: I've committed the patch. Thank you very much for contributing! -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19940

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

2014-04-28 Thread Roundup Robot
Roundup Robot added the comment: New changeset 7191c37238d5 by Antoine Pitrou in branch 'default': Issue #19940: ssl.cert_time_to_seconds() now interprets the given time string in the UTC timezone (as specified in RFC 5280), not the local timezone. http://hg.python.org/cpython/rev/7191c37238d5

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

2014-04-28 Thread akira
akira added the comment: Antoine, thank you for reviewing. I appreciate the patience. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19940 ___

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

2014-04-27 Thread akira
akira added the comment: Here's a new patch with a simplified ssl.cert_time_to_seconds() implementation that brings strptime() back. The behaviour is changed: - accept both %e and %d strftime formats for days as strptime-based implementation did before - return an integer instead of a float

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

2014-04-27 Thread akira
akira added the comment: Replace IndexError with ValueError in the patch because tuple.index raises ValueError. -- Added file: http://bugs.python.org/file35051/ssl_cert_time_to_seconds-ps5.patch ___ Python tracker rep...@bugs.python.org

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

2014-03-23 Thread akira
akira added the comment: Antoine, I haven't received the e-mail notification. I've replied to the comments on Rietveld. Here's the updated patch with the corresponding changes. -- Added file: http://bugs.python.org/file34594/ssl_cert_time_to_seconds-ps3.patch

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

2014-02-27 Thread Antoine Pitrou
Antoine Pitrou added the comment: Akira, thanks. I have posted a review; if you haven't received the e-mail notification, you can still access it at http://bugs.python.org/review/19940/#ps11142 -- stage: needs patch - patch review versions: +Python 3.5 -Python 3.4

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

2014-02-23 Thread akira
akira added the comment: The point of the locale issue is that notBefore, notAfter strings do not change if your locale changes. You don't need a new regex for each locale. I've attached ssl_cert_time_seconds.py file that contains example cert_time_to_seconds(cert_time) implementation that

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

2014-02-23 Thread Antoine Pitrou
Antoine Pitrou added the comment: Akira, do you want to write a proper patch with tests? If you are interested, you can take a look at http://docs.python.org/devguide/ You'll also have to sign a contributor's agreement at http://www.python.org/psf/contrib/contrib-form/ --

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

2014-02-23 Thread akira
akira added the comment: Antoine, I've signed the agreement. I've added ssl_cert_time_toseconds.patch with code, tests, and documention updates. -- keywords: +patch Added file: http://bugs.python.org/file34201/ssl_cert_time_to_seconds.patch ___

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

2013-12-29 Thread gudge
gudge added the comment: Can you please provide some hints on how to handle http://bugs.python.org/issue19940#msg205860. The value of format_regex 1) Without locale set: re.compile('(?Pbjan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\\s+(?Pd3[0-1]|[1-2]\\d|0[1- 9]|[1-9]|

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

2013-12-22 Thread gudge
gudge added the comment: 1) I understand I can run a whole test suite as ./python -m test -v test_abc as mentioned in http://docs.python.org/devguide/runtests.html How do I run a particluar test case, like the test I added test_cert_time_to_seconds 2) I have a added a test case

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

2013-12-21 Thread gudge
gudge added the comment: Akira, I will fix it. I will put in the patch in the same bug. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19940 ___

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

2013-12-19 Thread gudge
gudge added the comment: 1) Can I get a list of failures. The summary of test results which I compare on my machine. 2) - import ssl ssl.cert_time_to_seconds(May 9 00:00:00 2007 GMT)

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

2013-12-19 Thread gudge
gudge added the comment: Sorry I think I did not read msg205774 (1st comment) correctly. It clearly says: cert_time_to_seconds() uses `time.mktime()` [1] to convert utc time tuple to seconds since epoch. `mktime()` works with local time. It should use `calendar.timegm()` analog instead. So

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

2013-12-19 Thread Antoine Pitrou
Antoine Pitrou added the comment: So the function cert_time_to_seconds() has to be fixed? Yes! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19940 ___

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

2013-12-19 Thread gudge
gudge added the comment: Patch is uploaded. I will also copy paste it. I have created the patch with git. Let me know if it is okay with you. If it is unacceptable I will try and create one for mercury Patch: -- diff --combined

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

2013-12-19 Thread Antoine Pitrou
Antoine Pitrou added the comment: Answering to your questions: I have created the patch with git. Let me know if it is okay with you. Yes, it's ok. Also, please don't copy / paste it. Uploading is enough. Doc changes won't effect the code. The tests would not fail. How would I check if

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

2013-12-19 Thread akira
akira added the comment: gudge, have you seen http://bugs.python.org/msg205860 (the locale issue)? If you can't fix it; say so, I'll open another issue after this issue is fixed. -- ___ Python tracker rep...@bugs.python.org

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

2013-12-10 Thread Tim Golden
Changes by Tim Golden m...@timgolden.me.uk: -- versions: -Python 2.6, Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19940 ___

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

2013-12-10 Thread gudge
gudge added the comment: Will work on this. Please assign the issue to me. Instructions before proceeding by Tim Golden(python mailing list): Having just glanced at that issue, I would point out that there's been a lot of development around the ssl module for the 3.4 release, so you definitely

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

2013-12-10 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +christian.heimes, giampaolo.rodola, janssen, pitrou versions: -Python 2.7, Python 3.3, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19940

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

2013-12-10 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- assignee: docs@python - components: -Documentation ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19940 ___

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

2013-12-10 Thread Antoine Pitrou
Antoine Pitrou added the comment: Indeed the example in the docs is wrong, and so is the current behaviour. The example shows round-tripping using ssl.cert_time_to_seconds() and then time.ctime(), except that it is bogus as it takes a GMT time and ctime() returns a local time (Convert a time

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

2013-12-10 Thread Antoine Pitrou
Antoine Pitrou added the comment: gudge, your contribution is welcome! If you need guidance about how to write a patch, you can read the developer's guide: http://docs.python.org/devguide/ Also you will have to sign a contributor's agreement: http://www.python.org/psf/contrib/ --

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

2013-12-10 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' g.rod...@gmail.com: -- nosy: -giampaolo.rodola ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19940 ___ ___

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

2013-12-10 Thread akira
akira added the comment: gudge, There is also an issue with the current strptime format [1] (`%b %d %H:%M:%S %Y GMT`). It is locale-dependent and it may fail if a non-English locale is in effect. I don't know whether I should open a new issue on this or are you going to fix it too.

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

2013-12-09 Thread akira
New submission from akira: cert_time_to_seconds() uses `time.mktime()` [1] to convert utc time tuple to seconds since epoch. `mktime()` works with local time. It should use `calendar.timegm()` analog instead. Example from the docs [2] is seven hours off (it shows utc offset of the local