asyncio: Add __weakref__ slots to Handle and CoroWrapper. Upstream issue #166.

This commit is contained in:
Guido van Rossum 2014-04-27 10:44:22 -07:00
parent 83c1ddda46
commit 94ba146d11
4 changed files with 16 additions and 2 deletions

View file

@ -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):