Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
7657f6ba
Kaydet (Commit)
7657f6ba
authored
May 13, 2016
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #26848: Fix asyncio/subprocess.communicate() to handle empty input.
üst
d76c7c2b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
1 deletion
+23
-1
subprocess.py
Lib/asyncio/subprocess.py
+1
-1
test_subprocess.py
Lib/test/test_asyncio/test_subprocess.py
+19
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/asyncio/subprocess.py
Dosyayı görüntüle @
7657f6ba
...
...
@@ -166,7 +166,7 @@ class Process:
@coroutine
def
communicate
(
self
,
input
=
None
):
if
input
:
if
input
is
not
None
:
stdin
=
self
.
_feed_stdin
(
input
)
else
:
stdin
=
self
.
_noop
()
...
...
Lib/test/test_asyncio/test_subprocess.py
Dosyayı görüntüle @
7657f6ba
...
...
@@ -287,6 +287,25 @@ class SubprocessMixin:
self
.
assertEqual
(
output
.
rstrip
(),
b
'3'
)
self
.
assertEqual
(
exitcode
,
0
)
def
test_empty_input
(
self
):
@asyncio.coroutine
def
empty_input
():
code
=
'import sys; data = sys.stdin.read(); print(len(data))'
proc
=
yield
from
asyncio
.
create_subprocess_exec
(
sys
.
executable
,
'-c'
,
code
,
stdin
=
asyncio
.
subprocess
.
PIPE
,
stdout
=
asyncio
.
subprocess
.
PIPE
,
stderr
=
asyncio
.
subprocess
.
PIPE
,
close_fds
=
False
,
loop
=
self
.
loop
)
stdout
,
stderr
=
yield
from
proc
.
communicate
(
b
''
)
exitcode
=
yield
from
proc
.
wait
()
return
(
stdout
,
exitcode
)
output
,
exitcode
=
self
.
loop
.
run_until_complete
(
empty_input
())
self
.
assertEqual
(
output
.
rstrip
(),
b
'0'
)
self
.
assertEqual
(
exitcode
,
0
)
def
test_cancel_process_wait
(
self
):
# Issue #23140: cancel Process.wait()
...
...
Misc/NEWS
Dosyayı görüntüle @
7657f6ba
...
...
@@ -436,6 +436,9 @@ Library
-
Issue
#
26406
:
Avoid
unnecessary
serialization
of
getaddrinfo
(
3
)
calls
on
current
versions
of
OpenBSD
and
NetBSD
.
Patch
by
A
.
Jesse
Jiryu
Davis
.
-
Issue
#
26848
:
Fix
asyncio
/
subprocess
.
communicate
()
to
handle
empty
input
.
Patch
by
Jack
O
'Connor.
Documentation
-------------
...
...
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