summaryrefslogtreecommitdiffstats
path: root/Lib/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/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/selectors.py')
-rw-r--r--Lib/selectors.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/selectors.py b/Lib/selectors.py
index 598845d4..6d569c3 100644
--- a/Lib/selectors.py
+++ b/Lib/selectors.py
@@ -174,6 +174,8 @@ class BaseSelector(metaclass=ABCMeta):
SelectorKey for this file object
"""
mapping = self.get_map()
+ if mapping is None:
+ raise RuntimeError('Selector is closed')
try:
return mapping[fileobj]
except KeyError:
@@ -256,6 +258,7 @@ class _BaseSelectorImpl(BaseSelector):
def close(self):
self._fd_to_key.clear()
+ self._map = None
def get_map(self):
return self._map