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
eacbbdfb
Kaydet (Commit)
eacbbdfb
authored
Mar 03, 2009
tarafından
Hirokazu Yamamoto
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #5179: Fixed subprocess handle leak on failure on windows.
üst
8355155f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
33 deletions
+18
-33
subprocess.py
Lib/subprocess.py
+15
-32
NEWS
Misc/NEWS
+2
-0
_subprocess.c
PC/_subprocess.c
+1
-1
No files found.
Lib/subprocess.py
Dosyayı görüntüle @
eacbbdfb
...
...
@@ -642,21 +642,13 @@ class Popen(object):
c2pread
,
c2pwrite
,
errread
,
errwrite
)
# On Windows, you cannot just redirect one or two handles: You
# either have to redirect all three or none. If the subprocess
# user has only redirected one or two handles, we are
# automatically creating PIPEs for the rest. We should close
# these after the process is started. See bug #1124861.
if
mswindows
:
if
stdin
is
None
and
p2cwrite
is
not
None
:
os
.
close
(
p2cwrite
)
p2cwrite
=
None
if
stdout
is
None
and
c2pread
is
not
None
:
os
.
close
(
c2pread
)
c2pread
=
None
if
stderr
is
None
and
errread
is
not
None
:
os
.
close
(
errread
)
errread
=
None
if
p2cwrite
is
not
None
:
p2cwrite
=
msvcrt
.
open_osfhandle
(
p2cwrite
.
Detach
(),
0
)
if
c2pread
is
not
None
:
c2pread
=
msvcrt
.
open_osfhandle
(
c2pread
.
Detach
(),
0
)
if
errread
is
not
None
:
errread
=
msvcrt
.
open_osfhandle
(
errread
.
Detach
(),
0
)
if
p2cwrite
is
not
None
:
self
.
stdin
=
os
.
fdopen
(
p2cwrite
,
'wb'
,
bufsize
)
...
...
@@ -740,13 +732,10 @@ class Popen(object):
if
stdin
is
None
:
p2cread
=
GetStdHandle
(
STD_INPUT_HANDLE
)
if
p2cread
is
not
None
:
pass
elif
stdin
is
None
or
stdin
==
PIPE
:
if
p2cread
is
None
:
p2cread
,
_
=
CreatePipe
(
None
,
0
)
elif
stdin
==
PIPE
:
p2cread
,
p2cwrite
=
CreatePipe
(
None
,
0
)
# Detach and turn into fd
p2cwrite
=
p2cwrite
.
Detach
()
p2cwrite
=
msvcrt
.
open_osfhandle
(
p2cwrite
,
0
)
elif
isinstance
(
stdin
,
int
):
p2cread
=
msvcrt
.
get_osfhandle
(
stdin
)
else
:
...
...
@@ -756,13 +745,10 @@ class Popen(object):
if
stdout
is
None
:
c2pwrite
=
GetStdHandle
(
STD_OUTPUT_HANDLE
)
if
c2pwrite
is
not
None
:
pass
elif
stdout
is
None
or
stdout
==
PIPE
:
if
c2pwrite
is
None
:
_
,
c2pwrite
=
CreatePipe
(
None
,
0
)
elif
stdout
==
PIPE
:
c2pread
,
c2pwrite
=
CreatePipe
(
None
,
0
)
# Detach and turn into fd
c2pread
=
c2pread
.
Detach
()
c2pread
=
msvcrt
.
open_osfhandle
(
c2pread
,
0
)
elif
isinstance
(
stdout
,
int
):
c2pwrite
=
msvcrt
.
get_osfhandle
(
stdout
)
else
:
...
...
@@ -772,13 +758,10 @@ class Popen(object):
if
stderr
is
None
:
errwrite
=
GetStdHandle
(
STD_ERROR_HANDLE
)
if
errwrite
is
not
None
:
pass
elif
stderr
is
None
or
stderr
==
PIPE
:
if
errwrite
is
None
:
_
,
errwrite
=
CreatePipe
(
None
,
0
)
elif
stderr
==
PIPE
:
errread
,
errwrite
=
CreatePipe
(
None
,
0
)
# Detach and turn into fd
errread
=
errread
.
Detach
()
errread
=
msvcrt
.
open_osfhandle
(
errread
,
0
)
elif
stderr
==
STDOUT
:
errwrite
=
c2pwrite
elif
isinstance
(
stderr
,
int
):
...
...
Misc/NEWS
Dosyayı görüntüle @
eacbbdfb
...
...
@@ -168,6 +168,8 @@ Core and Builtins
Library
-------
- Issue #5179: Fixed subprocess handle leak on failure on windows.
- PEP 372: Added collections.OrderedDict().
- The _asdict() for method for namedtuples now returns an OrderedDict().
...
...
PC/_subprocess.c
Dosyayı görüntüle @
eacbbdfb
...
...
@@ -87,7 +87,7 @@ sp_handle_detach(sp_handle_object* self, PyObject* args)
handle
=
self
->
handle
;
self
->
handle
=
NULL
;
self
->
handle
=
INVALID_HANDLE_VALUE
;
/* note: return the current handle, as an integer */
return
HANDLE_TO_PYNUM
(
handle
);
...
...
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