summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_select.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-11-01 19:16:07 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-11-01 19:16:07 (GMT)
commit787fbe9d6b1072ff5a8317f39eaed1a409f263f1 (patch)
treeea356e874579f382c4e912053683332762738731 /Lib/test/test_select.py
parent53d36b691241f278fa6173034e6edb10154e62d3 (diff)
parent0168d3d9b1f6c236b23afedab3c61254fcb6f072 (diff)
downloadcpython-787fbe9d6b1072ff5a8317f39eaed1a409f263f1.zip
cpython-787fbe9d6b1072ff5a8317f39eaed1a409f263f1.tar.gz
cpython-787fbe9d6b1072ff5a8317f39eaed1a409f263f1.tar.bz2
Issue #16230: Fix a crash in select.select() when one the lists changes size while iterated on.
Patch by Serhiy Storchaka.
Diffstat (limited to 'Lib/test/test_select.py')
-rw-r--r--Lib/test/test_select.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_select.py b/Lib/test/test_select.py
index 6a810c6..496709c 100644
--- a/Lib/test/test_select.py
+++ b/Lib/test/test_select.py
@@ -65,6 +65,16 @@ class SelectTestCase(unittest.TestCase):
self.fail('Unexpected return values from select():', rfd, wfd, xfd)
p.close()
+ # Issue 16230: Crash on select resized list
+ def test_select_mutated(self):
+ a = []
+ class F:
+ def fileno(self):
+ del a[-1]
+ return sys.__stdout__.fileno()
+ a[:] = [F()] * 10
+ self.assertEqual(select.select([], a, []), ([], a[:5], []))
+
def test_main():
support.run_unittest(SelectTestCase)
support.reap_children()