Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
0552fc2b
Commit
0552fc2b
authored
Nov 01, 2012
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #16230: Fix a crash in select.select() when one the lists changes size while iterated on.
Patch by Serhiy Storchaka.
parent
e9e35c3f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
Lib/test/test_select.py
Lib/test/test_select.py
+9
-0
Misc/NEWS
Misc/NEWS
+3
-0
Modules/selectmodule.c
Modules/selectmodule.c
+1
-4
No files found.
Lib/test/test_select.py
View file @
0552fc2b
...
@@ -49,6 +49,15 @@ class SelectTestCase(unittest.TestCase):
...
@@ -49,6 +49,15 @@ class SelectTestCase(unittest.TestCase):
self
.
fail
(
'Unexpected return values from select():'
,
rfd
,
wfd
,
xfd
)
self
.
fail
(
'Unexpected return values from select():'
,
rfd
,
wfd
,
xfd
)
p
.
close
()
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
():
def
test_main
():
test_support
.
run_unittest
(
SelectTestCase
)
test_support
.
run_unittest
(
SelectTestCase
)
...
...
Misc/NEWS
View file @
0552fc2b
...
@@ -130,6 +130,9 @@ Core and Builtins
...
@@ -130,6 +130,9 @@ Core and Builtins
Library
Library
-------
-------
-
Issue
#
16230
:
Fix
a
crash
in
select
.
select
()
when
one
the
lists
changes
size
while
iterated
on
.
Patch
by
Serhiy
Storchaka
.
-
Issue
#
16228
:
Fix
a
crash
in
the
json
module
where
a
list
changes
size
-
Issue
#
16228
:
Fix
a
crash
in
the
json
module
where
a
list
changes
size
while
it
is
being
encoded
.
Patch
by
Serhiy
Storchaka
.
while
it
is
being
encoded
.
Patch
by
Serhiy
Storchaka
.
...
...
Modules/selectmodule.c
View file @
0552fc2b
...
@@ -87,7 +87,6 @@ seq2set(PyObject *seq, fd_set *set, pylist fd2obj[FD_SETSIZE + 1])
...
@@ -87,7 +87,6 @@ seq2set(PyObject *seq, fd_set *set, pylist fd2obj[FD_SETSIZE + 1])
int
i
;
int
i
;
int
max
=
-
1
;
int
max
=
-
1
;
int
index
=
0
;
int
index
=
0
;
int
len
=
-
1
;
PyObject
*
fast_seq
=
NULL
;
PyObject
*
fast_seq
=
NULL
;
PyObject
*
o
=
NULL
;
PyObject
*
o
=
NULL
;
...
@@ -98,9 +97,7 @@ seq2set(PyObject *seq, fd_set *set, pylist fd2obj[FD_SETSIZE + 1])
...
@@ -98,9 +97,7 @@ seq2set(PyObject *seq, fd_set *set, pylist fd2obj[FD_SETSIZE + 1])
if
(
!
fast_seq
)
if
(
!
fast_seq
)
return
-
1
;
return
-
1
;
len
=
PySequence_Fast_GET_SIZE
(
fast_seq
);
for
(
i
=
0
;
i
<
PySequence_Fast_GET_SIZE
(
fast_seq
);
i
++
)
{
for
(
i
=
0
;
i
<
len
;
i
++
)
{
SOCKET
v
;
SOCKET
v
;
/* any intervening fileno() calls could decr this refcnt */
/* any intervening fileno() calls could decr this refcnt */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment