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
1812f8cf
Commit
1812f8cf
authored
Jan 07, 2007
by
Peter Astrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid O(N**2) bottleneck in _communicate_(). Fixes #1598181.
parent
ec05a2d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
Lib/subprocess.py
Lib/subprocess.py
+4
-3
No files found.
Lib/subprocess.py
View file @
1812f8cf
...
...
@@ -1111,6 +1111,7 @@ class Popen(object):
read_set
.
append
(
self
.
stderr
)
stderr
=
[]
input_offset
=
0
while
read_set
or
write_set
:
rlist
,
wlist
,
xlist
=
select
.
select
(
read_set
,
write_set
,
[])
...
...
@@ -1118,9 +1119,9 @@ class Popen(object):
# When select has indicated that the file is writable,
# we can write up to PIPE_BUF bytes without risk
# blocking. POSIX defines PIPE_BUF >= 512
bytes_written
=
os
.
write
(
self
.
stdin
.
fileno
(),
input
[:
512
]
)
input
=
input
[
bytes_written
:]
if
not
input
:
bytes_written
=
os
.
write
(
self
.
stdin
.
fileno
(),
buffer
(
input
,
input_offset
,
512
)
)
input
_offset
+=
bytes_written
if
input_offset
>=
len
(
input
)
:
self
.
stdin
.
close
()
write_set
.
remove
(
self
.
stdin
)
...
...
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