diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-01-13 10:04:24 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-01-13 10:04:24 +0100 |
commit | 81052bee65e9e1c687d9052e64e8c0928dde950b (patch) | |
tree | e77b7646aff93e7b728064a1f9dbe1d61c2d36d7 /tests | |
parent | 5aa19c06b0afb5b778016132875274f44aa3bab7 (diff) | |
download | trollius-81052bee65e9e1c687d9052e64e8c0928dde950b.tar.gz |
Python 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 'tests')
-rw-r--r-- | tests/test_selectors.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/test_selectors.py b/tests/test_selectors.py index 3d5ef91..49b5b8d 100644 --- a/tests/test_selectors.py +++ b/tests/test_selectors.py @@ -159,14 +159,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() @@ -233,8 +236,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() |