summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_selectors.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-01-13 09:00:55 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-01-13 09:00:55 (GMT)
commit458fc6f98ca9a838af5dcdff64fd48ae3eb64fa9 (patch)
tree2f5ebe056493b3bc7ed8931fb9ca141fd150340d /Lib/test/test_selectors.py
parent17cba7daf5cdbe2a0e589be9ef507408b8dc07f1 (diff)
parent38dc250521d2c34f58537b25301a0ac9a4bb6c85 (diff)
downloadcpython-458fc6f98ca9a838af5dcdff64fd48ae3eb64fa9.zip
cpython-458fc6f98ca9a838af5dcdff64fd48ae3eb64fa9.tar.gz
cpython-458fc6f98ca9a838af5dcdff64fd48ae3eb64fa9.tar.bz2
Issue #23209, #23225: selectors.BaseSelector.get_key() now raises a
RuntimeError if the selector is closed. And selectors.BaseSelector.close() now clears its internal reference to the selector mapping to break a reference cycle. Initial patch written by Martin Richard.
Diffstat (limited to 'Lib/test/test_selectors.py')
-rw-r--r--Lib/test/test_selectors.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/test/test_selectors.py b/Lib/test/test_selectors.py
index 493a5a6..15f71c1 100644
--- a/Lib/test/test_selectors.py
+++ b/Lib/test/test_selectors.py
@@ -178,14 +178,17 @@ class BaseSelectorTestCase(unittest.TestCase):
s = self.SELECTOR()
self.addCleanup(s.close)
+ mapping = s.get_map()
rd, wr = self.make_socketpair()
s.register(rd, selectors.EVENT_READ)
s.register(wr, selectors.EVENT_WRITE)
s.close()
- self.assertRaises(KeyError, s.get_key, rd)
- self.assertRaises(KeyError, s.get_key, wr)
+ self.assertRaises(RuntimeError, s.get_key, rd)
+ self.assertRaises(RuntimeError, s.get_key, wr)
+ self.assertRaises(KeyError, mapping.__getitem__, rd)
+ self.assertRaises(KeyError, mapping.__getitem__, wr)
def test_get_key(self):
s = self.SELECTOR()
@@ -252,8 +255,8 @@ class BaseSelectorTestCase(unittest.TestCase):
sel.register(rd, selectors.EVENT_READ)
sel.register(wr, selectors.EVENT_WRITE)
- self.assertRaises(KeyError, s.get_key, rd)
- self.assertRaises(KeyError, s.get_key, wr)
+ self.assertRaises(RuntimeError, s.get_key, rd)
+ self.assertRaises(RuntimeError, s.get_key, wr)
def test_fileno(self):
s = self.SELECTOR()