cpython: 87ccf2635ad7 (original) (raw)
Mercurial > cpython
changeset 80161:87ccf2635ad7 3.2
Issue #16230: Fix a crash in select.select() when one the lists changes size while iterated on. Patch by Serhiy Storchaka. [#16230]
Antoine Pitrou solipsis@pitrou.net | |
---|---|
date | Thu, 01 Nov 2012 20:13:54 +0100 |
parents | 3672db224eb3 |
children | 717660ec8f67 2bf99322218f |
files | Lib/test/test_select.py Misc/NEWS Modules/selectmodule.c |
diffstat | 3 files changed, 15 insertions(+), 4 deletions(-)[+] [-] Lib/test/test_select.py 10 Misc/NEWS 3 Modules/selectmodule.c 6 |
line wrap: on
line diff
--- a/Lib/test/test_select.py +++ b/Lib/test/test_select.py @@ -49,6 +49,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 = [][](#l1.9)
class F:[](#l1.10)
def fileno(self):[](#l1.11)
del a[-1][](#l1.12)
return sys.__stdout__.fileno()[](#l1.13)
a[:] = [F()] * 10[](#l1.14)
self.assertEqual(select.select([], a, []), ([], a[:5], []))[](#l1.15)
+ def test_main(): support.run_unittest(SelectTestCase) support.reap_children()
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -143,6 +143,9 @@ Core and Builtins Library ------- +- Issue #16230: Fix a crash in select.select() when one the lists changes
- Issue #16228: Fix a crash in the json module where a list changes size while it is being encoded. Patch by Serhiy Storchaka.
--- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -83,7 +83,7 @@ seq2set(PyObject *seq, fd_set *set, pyli { int max = -1; int index = 0;