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
927131e0
Kaydet (Commit)
927131e0
authored
Ara 10, 2014
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #23016: A warning no longer produces an AttributeError when the program
is run with pythonw.exe.
üst
649e1f14
60599525
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
0 deletions
+15
-0
test_warnings.py
Lib/test/test_warnings.py
+9
-0
warnings.py
Lib/warnings.py
+3
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_warnings.py
Dosyayı görüntüle @
927131e0
...
@@ -666,6 +666,15 @@ class _WarningsTests(BaseTest, unittest.TestCase):
...
@@ -666,6 +666,15 @@ class _WarningsTests(BaseTest, unittest.TestCase):
finally
:
finally
:
globals_dict
[
'__file__'
]
=
oldfile
globals_dict
[
'__file__'
]
=
oldfile
def
test_stderr_none
(
self
):
rc
,
stdout
,
stderr
=
assert_python_ok
(
"-c"
,
"import sys; sys.stderr = None; "
"import warnings; warnings.simplefilter('always'); "
"warnings.warn('Warning!')"
)
self
.
assertEqual
(
stdout
,
b
''
)
self
.
assertNotIn
(
b
'Warning!'
,
stderr
)
self
.
assertNotIn
(
b
'Error'
,
stderr
)
class
WarningsDisplayTests
(
BaseTest
):
class
WarningsDisplayTests
(
BaseTest
):
...
...
Lib/warnings.py
Dosyayı görüntüle @
927131e0
...
@@ -11,6 +11,9 @@ def showwarning(message, category, filename, lineno, file=None, line=None):
...
@@ -11,6 +11,9 @@ def showwarning(message, category, filename, lineno, file=None, line=None):
"""Hook to write a warning to a file; replace if you like."""
"""Hook to write a warning to a file; replace if you like."""
if
file
is
None
:
if
file
is
None
:
file
=
sys
.
stderr
file
=
sys
.
stderr
if
file
is
None
:
# sys.stderr is None when ran with pythonw.exe - warnings get lost
return
try
:
try
:
file
.
write
(
formatwarning
(
message
,
category
,
filename
,
lineno
,
line
))
file
.
write
(
formatwarning
(
message
,
category
,
filename
,
lineno
,
line
))
except
OSError
:
except
OSError
:
...
...
Misc/NEWS
Dosyayı görüntüle @
927131e0
...
@@ -194,6 +194,9 @@ Core and Builtins
...
@@ -194,6 +194,9 @@ Core and Builtins
Library
Library
-------
-------
-
Issue
#
23016
:
A
warning
no
longer
produces
an
AttributeError
when
the
program
is
run
with
pythonw
.
exe
.
-
Issue
#
21775
:
shutil
.
copytree
():
fix
crash
when
copying
to
VFAT
.
An
exception
-
Issue
#
21775
:
shutil
.
copytree
():
fix
crash
when
copying
to
VFAT
.
An
exception
handler
assumed
that
that
OSError
objects
always
have
a
'winerror'
attribute
.
handler
assumed
that
that
OSError
objects
always
have
a
'winerror'
attribute
.
That
is
not
the
case
,
so
the
exception
handler
itself
raised
AttributeError
That
is
not
the
case
,
so
the
exception
handler
itself
raised
AttributeError
...
...
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