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
481cb70a
Kaydet (Commit)
481cb70a
authored
Mar 03, 2017
tarafından
Seth M. Larson
Kaydeden (comit)
Yury Selivanov
Mar 03, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-29704: Fix asyncio.SubprocessStreamProtocol closing (#405)
üst
398ff91a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
2 deletions
+40
-2
subprocess.py
Lib/asyncio/subprocess.py
+15
-2
test_subprocess.py
Lib/test/test_asyncio/test_subprocess.py
+22
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/asyncio/subprocess.py
Dosyayı görüntüle @
481cb70a
...
...
@@ -24,6 +24,8 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
self
.
_limit
=
limit
self
.
stdin
=
self
.
stdout
=
self
.
stderr
=
None
self
.
_transport
=
None
self
.
_process_exited
=
False
self
.
_pipe_fds
=
[]
def
__repr__
(
self
):
info
=
[
self
.
__class__
.
__name__
]
...
...
@@ -43,12 +45,14 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
self
.
stdout
=
streams
.
StreamReader
(
limit
=
self
.
_limit
,
loop
=
self
.
_loop
)
self
.
stdout
.
set_transport
(
stdout_transport
)
self
.
_pipe_fds
.
append
(
1
)
stderr_transport
=
transport
.
get_pipe_transport
(
2
)
if
stderr_transport
is
not
None
:
self
.
stderr
=
streams
.
StreamReader
(
limit
=
self
.
_limit
,
loop
=
self
.
_loop
)
self
.
stderr
.
set_transport
(
stderr_transport
)
self
.
_pipe_fds
.
append
(
2
)
stdin_transport
=
transport
.
get_pipe_transport
(
0
)
if
stdin_transport
is
not
None
:
...
...
@@ -85,10 +89,19 @@ class SubprocessStreamProtocol(streams.FlowControlMixin,
reader
.
feed_eof
()
else
:
reader
.
set_exception
(
exc
)
if
fd
in
self
.
_pipe_fds
:
self
.
_pipe_fds
.
remove
(
fd
)
self
.
_maybe_close_transport
()
def
process_exited
(
self
):
self
.
_transport
.
close
()
self
.
_transport
=
None
self
.
_process_exited
=
True
self
.
_maybe_close_transport
()
def
_maybe_close_transport
(
self
):
if
len
(
self
.
_pipe_fds
)
==
0
and
self
.
_process_exited
:
self
.
_transport
.
close
()
self
.
_transport
=
None
class
Process
:
...
...
Lib/test/test_asyncio/test_subprocess.py
Dosyayı görüntüle @
481cb70a
...
...
@@ -459,6 +459,28 @@ class SubprocessMixin:
self
.
loop
.
run_until_complete
(
create
)
self
.
assertEqual
(
warns
,
[])
def
test_read_stdout_after_process_exit
(
self
):
@asyncio.coroutine
def
execute
():
code
=
'
\n
'
.
join
([
'import sys'
,
'for _ in range(64):'
,
' sys.stdout.write("x" * 4096)'
,
'sys.stdout.flush()'
,
'sys.exit(1)'
])
fut
=
asyncio
.
create_subprocess_exec
(
sys
.
executable
,
'-c'
,
code
,
stdout
=
asyncio
.
subprocess
.
PIPE
,
loop
=
self
.
loop
)
process
=
yield
from
fut
while
True
:
data
=
yield
from
process
.
stdout
.
read
(
65536
)
if
data
:
yield
from
asyncio
.
sleep
(
0.3
,
loop
=
self
.
loop
)
else
:
break
self
.
loop
.
run_until_complete
(
execute
())
if
sys
.
platform
!=
'win32'
:
# Unix
...
...
Misc/NEWS
Dosyayı görüntüle @
481cb70a
...
...
@@ -259,6 +259,9 @@ Extension Modules
Library
-------
-
bpo
-
29704
:
asyncio
.
subprocess
.
SubprocessStreamProtocol
no
longer
closes
before
all
pipes
are
closed
.
-
bpo
-
29271
:
Fix
Task
.
current_task
and
Task
.
all_tasks
implemented
in
C
to
accept
None
argument
as
their
pure
Python
implementation
.
...
...
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