changeset: 97223:73902903d397 parent: 97220:5a13a3f3bb3b parent: 97222:06406205ae99 user: Robert Collins date: Tue Aug 04 10:07:21 2015 +1200 files: Misc/NEWS description: Issue #23888: Handle fractional time in cookie expiry. Patch by ssh. diff -r 5a13a3f3bb3b -r 73902903d397 Lib/http/cookiejar.py --- a/Lib/http/cookiejar.py Mon Aug 03 14:57:21 2015 -0400 +++ b/Lib/http/cookiejar.py Tue Aug 04 10:07:21 2015 +1200 @@ -758,7 +758,7 @@ ): if version is not None: version = int(version) - if expires is not None: expires = int(expires) + if expires is not None: expires = int(float(expires)) if port is None and port_specified is True: raise ValueError("if port is None, port_specified must be false") diff -r 5a13a3f3bb3b -r 73902903d397 Lib/test/test_http_cookiejar.py --- a/Lib/test/test_http_cookiejar.py Mon Aug 03 14:57:21 2015 -0400 +++ b/Lib/test/test_http_cookiejar.py Tue Aug 04 10:07:21 2015 +1200 @@ -566,6 +566,15 @@ self.assertEqual(len(c), 1) self.assertIn('spam="bar"', h) + # test if fractional expiry is accepted + cookie = Cookie(0, "name", "value", + None, False, "www.python.org", + True, False, "/", + False, False, "1444312383.018307", + False, None, None, + {}) + self.assertEqual(cookie.expires, 1444312383) + # XXX RFC 2965 expiry rules (some apply to V0 too) def test_default_path(self): diff -r 5a13a3f3bb3b -r 73902903d397 Misc/NEWS --- a/Misc/NEWS Mon Aug 03 14:57:21 2015 -0400 +++ b/Misc/NEWS Tue Aug 04 10:07:21 2015 +1200 @@ -13,6 +13,8 @@ Library ------- +- Issue #23888: Handle fractional time in cookie expiry. Patch by ssh. + - Issue #23652: Make it possible to compile the select module against the libc headers from the Linux Standard Base, which do not include some EPOLL macros. Patch by Matt Frank.