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
580e0078
Kaydet (Commit)
580e0078
authored
Şub 10, 2014
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
issue12085: Use more Pythonic way to check _child_created.
_active shouldn't be cached, it set to None on shutdown.
üst
d667d72c
72e77613
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
+6
-7
subprocess.py
Lib/subprocess.py
+6
-7
No files found.
Lib/subprocess.py
Dosyayı görüntüle @
580e0078
...
...
@@ -738,6 +738,9 @@ _PLATFORM_DEFAULT_CLOSE_FDS = object()
class
Popen
(
object
):
_child_created
=
False
# Set here since __del__ checks it
def
__init__
(
self
,
args
,
bufsize
=-
1
,
executable
=
None
,
stdin
=
None
,
stdout
=
None
,
stderr
=
None
,
preexec_fn
=
None
,
close_fds
=
_PLATFORM_DEFAULT_CLOSE_FDS
,
...
...
@@ -748,7 +751,6 @@ class Popen(object):
"""Create new Popen instance."""
_cleanup
()
self
.
_child_created
=
False
self
.
_input
=
None
self
.
_communication_started
=
False
if
bufsize
is
None
:
...
...
@@ -890,11 +892,8 @@ class Popen(object):
# Wait for the process to terminate, to avoid zombies.
self
.
wait
()
def
__del__
(
self
,
_maxsize
=
sys
.
maxsize
,
_active
=
_active
):
# If __init__ hasn't had a chance to execute (e.g. if it
# was passed an undeclared keyword argument), we don't
# have a _child_created attribute at all.
if
not
getattr
(
self
,
'_child_created'
,
False
):
def
__del__
(
self
,
_maxsize
=
sys
.
maxsize
):
if
not
self
.
_child_created
:
# We didn't get to successfully create a child process.
return
# In case the child hasn't been waited on, check if it's done.
...
...
@@ -1446,7 +1445,7 @@ class Popen(object):
_WTERMSIG
=
os
.
WTERMSIG
,
_WIFEXITED
=
os
.
WIFEXITED
,
_WEXITSTATUS
=
os
.
WEXITSTATUS
):
# This method is called (indirectly) by __del__, so it cannot
# refer to anything outside of its local scope.
"""
# refer to anything outside of its local scope.
if
_WIFSIGNALED
(
sts
):
self
.
returncode
=
-
_WTERMSIG
(
sts
)
elif
_WIFEXITED
(
sts
):
...
...
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