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
f1512a29
Kaydet (Commit)
f1512a29
authored
Haz 21, 2011
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Close #12383: Fix subprocess module with env={}: don't copy the environment
variables, start with an empty environment.
üst
b7149cad
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
8 deletions
+20
-8
subprocess.py
Lib/subprocess.py
+1
-1
test_subprocess.py
Lib/test/test_subprocess.py
+16
-7
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/subprocess.py
Dosyayı görüntüle @
f1512a29
...
@@ -1169,7 +1169,7 @@ class Popen(object):
...
@@ -1169,7 +1169,7 @@ class Popen(object):
# potential deadlocks, thus we do all this here.
# potential deadlocks, thus we do all this here.
# and pass it to fork_exec()
# and pass it to fork_exec()
if
env
:
if
env
is
not
None
:
env_list
=
[
os
.
fsencode
(
k
)
+
b
'='
+
os
.
fsencode
(
v
)
env_list
=
[
os
.
fsencode
(
k
)
+
b
'='
+
os
.
fsencode
(
v
)
for
k
,
v
in
env
.
items
()]
for
k
,
v
in
env
.
items
()]
else
:
else
:
...
...
Lib/test/test_subprocess.py
Dosyayı görüntüle @
f1512a29
...
@@ -331,13 +331,22 @@ class ProcessTestCase(BaseTestCase):
...
@@ -331,13 +331,22 @@ class ProcessTestCase(BaseTestCase):
def
test_env
(
self
):
def
test_env
(
self
):
newenv
=
os
.
environ
.
copy
()
newenv
=
os
.
environ
.
copy
()
newenv
[
"FRUIT"
]
=
"orange"
newenv
[
"FRUIT"
]
=
"orange"
p
=
subprocess
.
Popen
([
sys
.
executable
,
"-c"
,
with
subprocess
.
Popen
([
sys
.
executable
,
"-c"
,
'import sys,os;'
'import sys,os;'
'sys.stdout.write(os.getenv("FRUIT"))'
],
'sys.stdout.write(os.getenv("FRUIT"))'
],
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
env
=
newenv
)
env
=
newenv
)
as
p
:
self
.
addCleanup
(
p
.
stdout
.
close
)
stdout
,
stderr
=
p
.
communicate
()
self
.
assertEqual
(
p
.
stdout
.
read
(),
b
"orange"
)
self
.
assertEqual
(
stdout
,
b
"orange"
)
def
test_empty_env
(
self
):
with
subprocess
.
Popen
([
sys
.
executable
,
"-c"
,
'import os; '
'print(len(os.environ))'
],
stdout
=
subprocess
.
PIPE
,
env
=
{})
as
p
:
stdout
,
stderr
=
p
.
communicate
()
self
.
assertEqual
(
stdout
.
strip
(),
b
"0"
)
def
test_communicate_stdin
(
self
):
def
test_communicate_stdin
(
self
):
p
=
subprocess
.
Popen
([
sys
.
executable
,
"-c"
,
p
=
subprocess
.
Popen
([
sys
.
executable
,
"-c"
,
...
...
Misc/NEWS
Dosyayı görüntüle @
f1512a29
...
@@ -25,6 +25,9 @@ Core and Builtins
...
@@ -25,6 +25,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #12383: Fix subprocess module with env={}: don't copy the environment
variables, start with an empty environment.
- Issue #11584: email.header.decode_header no longer fails if the header
- Issue #11584: email.header.decode_header no longer fails if the header
passed to it is a Header object, and Header/make_header no longer fail
passed to it is a Header object, and Header/make_header no longer fail
if given binary unknown-8bit input.
if given binary unknown-8bit input.
...
...
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