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
cdd98fb4
Kaydet (Commit)
cdd98fb4
authored
Nis 10, 2010
tarafından
Philip Jenvey
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fix PYTHONWARNINGS handling to not modify the original env value and improve
its tests
üst
b60ee469
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
test_warnings.py
Lib/test/test_warnings.py
+6
-3
main.c
Modules/main.c
+12
-7
No files found.
Lib/test/test_warnings.py
Dosyayı görüntüle @
cdd98fb4
...
...
@@ -683,7 +683,8 @@ class EnvironmentVariableTests(BaseTest):
p
=
subprocess
.
Popen
([
sys
.
executable
,
"-c"
,
"import sys; sys.stdout.write(str(sys.warnoptions))"
],
stdout
=
subprocess
.
PIPE
,
env
=
newenv
)
self
.
assertEqual
(
p
.
stdout
.
read
(),
"['ignore::DeprecationWarning']"
)
self
.
assertEqual
(
p
.
communicate
()[
0
],
"['ignore::DeprecationWarning']"
)
self
.
assertEqual
(
p
.
wait
(),
0
)
def
test_comma_separated_warnings
(
self
):
newenv
=
os
.
environ
.
copy
()
...
...
@@ -692,8 +693,9 @@ class EnvironmentVariableTests(BaseTest):
p
=
subprocess
.
Popen
([
sys
.
executable
,
"-c"
,
"import sys; sys.stdout.write(str(sys.warnoptions))"
],
stdout
=
subprocess
.
PIPE
,
env
=
newenv
)
self
.
assertEqual
(
p
.
stdout
.
read
()
,
self
.
assertEqual
(
p
.
communicate
()[
0
]
,
"['ignore::DeprecationWarning', 'ignore::UnicodeWarning']"
)
self
.
assertEqual
(
p
.
wait
(),
0
)
def
test_envvar_and_command_line
(
self
):
newenv
=
os
.
environ
.
copy
()
...
...
@@ -701,8 +703,9 @@ class EnvironmentVariableTests(BaseTest):
p
=
subprocess
.
Popen
([
sys
.
executable
,
"-W"
"ignore::UnicodeWarning"
,
"-c"
,
"import sys; sys.stdout.write(str(sys.warnoptions))"
],
stdout
=
subprocess
.
PIPE
,
env
=
newenv
)
self
.
assertEqual
(
p
.
stdout
.
read
()
,
self
.
assertEqual
(
p
.
communicate
()[
0
]
,
"['ignore::UnicodeWarning', 'ignore::DeprecationWarning']"
)
self
.
assertEqual
(
p
.
wait
(),
0
)
class
CEnvironmentVariableTests
(
EnvironmentVariableTests
):
module
=
c_warnings
...
...
Modules/main.c
Dosyayı görüntüle @
cdd98fb4
...
...
@@ -421,14 +421,19 @@ Py_Main(int argc, char **argv)
(
p
=
Py_GETENV
(
"PYTHONNOUSERSITE"
))
&&
*
p
!=
'\0'
)
Py_NoUserSiteDirectory
=
1
;
if
((
p
=
Py_GETENV
(
"PYTHONWARNINGS"
))
&&
*
p
!=
'\0'
)
{
char
*
warning
=
strtok
(
p
,
","
);
while
(
warning
!=
NULL
)
{
if
((
p
=
Py_GETENV
(
"PYTHONWARNINGS"
))
&&
*
p
!=
'\0'
)
{
char
*
buf
,
*
warning
;
buf
=
(
char
*
)
malloc
(
strlen
(
p
)
+
1
);
if
(
buf
==
NULL
)
Py_FatalError
(
"not enough memory to copy PYTHONWARNINGS"
);
strcpy
(
buf
,
p
);
for
(
warning
=
strtok
(
buf
,
","
);
warning
!=
NULL
;
warning
=
strtok
(
NULL
,
","
))
PySys_AddWarnOption
(
warning
);
warning
=
strtok
(
NULL
,
","
);
}
free
(
buf
);
}
if
(
command
==
NULL
&&
module
==
NULL
&&
_PyOS_optind
<
argc
&&
...
...
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