mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Issue #16230: Fix a crash in select.select() when one the lists changes size while iterated on.
Patch by Serhiy Storchaka.
This commit is contained in:
commit
787fbe9d6b
3 changed files with 15 additions and 4 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue