mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
asyncio: Add __weakref__ slots to Handle and CoroWrapper. Upstream issue #166.
This commit is contained in:
parent
83c1ddda46
commit
94ba146d11
4 changed files with 16 additions and 2 deletions
|
@ -21,6 +21,7 @@ import time
|
|||
import errno
|
||||
import unittest
|
||||
from unittest import mock
|
||||
import weakref
|
||||
from test import support # find_unused_port, IPV6_ENABLED, TEST_HOME_DIR
|
||||
|
||||
|
||||
|
@ -1786,6 +1787,11 @@ class HandleTests(unittest.TestCase):
|
|||
'handle': h
|
||||
})
|
||||
|
||||
def test_handle_weakref(self):
|
||||
wd = weakref.WeakValueDictionary()
|
||||
h = asyncio.Handle(lambda: None, (), object())
|
||||
wd['h'] = h # Would fail without __weakref__ slot.
|
||||
|
||||
|
||||
class TimerTests(unittest.TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue