This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients Scott.Wimer, demian.brecht, jcea, orsenthil, r.david.murray, terry.reedy, xtreak
Date 2019-03-18.18:20:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This issue is still reproducible on master and below is a unittest. The patch looks reasonable to me and fixes the issue. @demian.brecht, would you like to convert the patch to a PR ?

diff --git a/Lib/test/ b/Lib/test/
index 22bf41cf1d..3540a3d94f 100644
--- a/Lib/test/
+++ b/Lib/test/
@@ -585,6 +585,13 @@ class CookieTests(unittest.TestCase):
         # if expires is in future, keep cookie...
         c = CookieJar()
         future = time2netscape(time.time()+3600)
+        headers = ["Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/; expires={0}".format(future)]
+        req = urllib.request.Request("")
+        res = FakeResponse(headers, "")
+        cookies = c.make_cookies(res, req)
+        c = CookieJar()
         interact_netscape(c, "", 'spam="bar"; expires=%s' %
         self.assertEqual(len(c), 1)

$ ./python.exe -m unittest -v test.test_http_cookiejar.CookieTests.test_expires
test_expires (test.test_http_cookiejar.CookieTests) ... /Users/karthikeyansingaravelan/stuff/python/cpython/Lib/http/ UserWarning: http.cookiejar bug!
Traceback (most recent call last):
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/http/", line 1616, in make_cookies
    ns_cookies = self._cookies_from_attrs_set(
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/http/", line 1574, in _cookies_from_attrs_set
    cookie = self._cookie_from_cookie_tuple(tup, request)
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/http/", line 1546, in _cookie_from_cookie_tuple
    elif expires <= self._now:
AttributeError: 'CookieJar' object has no attribute '_now'


Ran 1 test in 0.043s

Date User Action Args
2019-03-18 18:20:43xtreaksetrecipients: + xtreak, terry.reedy, jcea, orsenthil, r.david.murray, Scott.Wimer, demian.brecht
2019-03-18 18:20:43xtreaksetmessageid: <>
2019-03-18 18:20:43xtreaklinkissue12144 messages
2019-03-18 18:20:43xtreakcreate