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
f3715d2f
Kaydet (Commit)
f3715d2f
authored
Şub 14, 2009
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#5179: don't leak PIPE fds when child execution fails.
üst
95777bb0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
subprocess.py
Lib/subprocess.py
+3
-0
test_subprocess.py
Lib/test/test_subprocess.py
+16
-0
No files found.
Lib/subprocess.py
Dosyayı görüntüle @
f3715d2f
...
...
@@ -1151,6 +1151,9 @@ class Popen(object):
if
data
!=
""
:
os
.
waitpid
(
self
.
pid
,
0
)
child_exception
=
pickle
.
loads
(
data
)
for
fd
in
(
p2cwrite
,
c2pread
,
errread
):
if
fd
is
not
None
:
os
.
close
(
fd
)
raise
child_exception
...
...
Lib/test/test_subprocess.py
Dosyayı görüntüle @
f3715d2f
...
...
@@ -520,6 +520,22 @@ class ProcessTestCase(unittest.TestCase):
else
:
self
.
fail
(
"Expected TypeError"
)
def
test_leaking_fds_on_error
(
self
):
# see bug #5179: Popen leaks file descriptors to PIPEs if
# the child fails to execute; this will eventually exhaust
# the maximum number of open fds. 1024 seems a very common
# value for that limit, but Windows has 2048, so we loop
# 1024 times (each call leaked two fds).
for
i
in
range
(
1024
):
try
:
subprocess
.
Popen
([
'nonexisting_i_hope'
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
# Windows raises IOError
except
(
IOError
,
OSError
),
err
:
if
err
.
errno
!=
2
:
# ignore "no such file"
raise
#
# POSIX tests
#
...
...
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