Skip to content

Commit 88f7ed8

Browse files
committed
Fix #1203: Create CookieJar without explicit loop passing
1 parent 0c8b3ef commit 88f7ed8

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CHANGES.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ CHANGES
88

99
- Add missing `WSMsgType` to `web_ws.__all__`, see #1200
1010

11-
-
11+
- Fix `CookieJar` ctor when called with `loop=None` #1203
1212

1313
-
1414

aiohttp/cookiejar.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(self, *, unsafe=False, loop=None):
3333
self._cookies = defaultdict(SimpleCookie)
3434
self._host_only_cookies = set()
3535
self._unsafe = unsafe
36-
self._next_expiration = ceil(loop.time())
36+
self._next_expiration = ceil(self._loop.time())
3737
self._expirations = {}
3838

3939
def clear(self):

tests/test_cookiejar.py

+6
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ def test_constructor(loop, cookies_to_send, cookies_to_receive):
140140
assert jar._loop is loop
141141

142142

143+
def test_ctor_ith_default_loop(loop):
144+
asyncio.set_event_loop(loop)
145+
jar = CookieJar()
146+
assert jar._loop is loop
147+
148+
143149
def test_domain_filter_ip_cookie_send(loop):
144150
jar = CookieJar(loop=loop)
145151
cookies = SimpleCookie(

0 commit comments

Comments
 (0)