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
401fb814
Commit
401fb814
authored
Jul 01, 2008
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#2683: Popen.communicate() argument must be bytes.
parent
6e8bdb39
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
8 deletions
+5
-8
Lib/subprocess.py
Lib/subprocess.py
+0
-6
Lib/test/test_subprocess.py
Lib/test/test_subprocess.py
+2
-2
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/subprocess.py
View file @
401fb814
...
...
@@ -883,8 +883,6 @@ class Popen(object):
if
self
.
stdin
:
if
input
is
not
None
:
if
isinstance
(
input
,
str
):
input
=
input
.
encode
()
self
.
stdin
.
write
(
input
)
self
.
stdin
.
close
()
...
...
@@ -1129,10 +1127,6 @@ class Popen(object):
def
_communicate
(
self
,
input
):
if
self
.
stdin
:
if
isinstance
(
input
,
str
):
# Unicode
input
=
input
.
encode
(
"utf-8"
)
# XXX What else?
input
=
bytes
(
input
)
read_set
=
[]
write_set
=
[]
stdout
=
None
# Return
...
...
Lib/test/test_subprocess.py
View file @
401fb814
...
...
@@ -302,7 +302,7 @@ class ProcessTestCase(unittest.TestCase):
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
(
stdout
,
stderr
)
=
p
.
communicate
(
"banana"
)
(
stdout
,
stderr
)
=
p
.
communicate
(
b
"banana"
)
self
.
assertEqual
(
stdout
,
b"banana"
)
self
.
assertEqual
(
remove_stderr_debug_decorations
(
stderr
),
b"pineapple"
)
...
...
@@ -420,7 +420,7 @@ class ProcessTestCase(unittest.TestCase):
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
data
=
p
.
communicate
(
"lime"
)[
0
]
data
=
p
.
communicate
(
b
"lime"
)[
0
]
self
.
assertEqual
(
data
,
b"lime"
)
...
...
Misc/NEWS
View file @
401fb814
...
...
@@ -17,6 +17,9 @@ Core and Builtins
Library
-------
- Issue #2683: Fix inconsistency in subprocess.Popen.communicate(): the
argument now must be a bytes object in any case.
- Issue #3145: help("modules whatever") failed when trying to load the source
code of every single module of the standard library, including invalid files
used in the test suite.
...
...
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