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
f198ac2d
Kaydet (Commit)
f198ac2d
authored
Agu 14, 2009
tarafından
Guilherme Polo
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #3926: Fix the usage of the new showwarnings and formatwarning.
üst
86b882f3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
15 deletions
+16
-15
PyShell.py
Lib/idlelib/PyShell.py
+12
-12
run.py
Lib/idlelib/run.py
+4
-3
No files found.
Lib/idlelib/PyShell.py
Dosyayı görüntüle @
f198ac2d
...
...
@@ -58,20 +58,21 @@ except ImportError:
else
:
def
idle_showwarning
(
message
,
category
,
filename
,
lineno
,
file
=
None
,
line
=
None
):
file
=
warning_stream
if
file
is
None
:
file
=
warning_stream
try
:
file
.
write
(
warnings
.
formatwarning
(
message
,
category
,
filename
,
\
file
.
write
(
warnings
.
formatwarning
(
message
,
category
,
filename
,
lineno
,
file
=
file
,
line
=
line
))
except
IOError
:
pass
## file (probably __stderr__) is invalid, warning dropped.
warnings
.
showwarning
=
idle_showwarning
def
idle_formatwarning
(
message
,
category
,
filename
,
lineno
,
file
=
None
,
line
=
None
):
def
idle_formatwarning
(
message
,
category
,
filename
,
lineno
,
line
=
None
):
"""Format warnings the IDLE way"""
s
=
"
\n
Warning (from warnings module):
\n
"
s
+=
' File
\"
%
s
\"
, line
%
s
\n
'
%
(
filename
,
lineno
)
line
=
linecache
.
getline
(
filename
,
lineno
)
.
strip
()
\
if
line
is
None
else
line
if
line
is
None
:
line
=
linecache
.
getline
(
filename
,
lineno
)
line
=
line
.
strip
()
if
line
:
s
+=
"
%
s
\n
"
%
line
s
+=
"
%
s:
%
s
\n
>>> "
%
(
category
.
__name__
,
message
)
...
...
@@ -84,18 +85,17 @@ def extended_linecache_checkcache(filename=None,
Rather than repeating the linecache code, patch it to save the
<pyshell#...> entries, call the original linecache.checkcache()
(
which destroys
them), and then restore the saved entries.
(
skipping
them), and then restore the saved entries.
orig_checkcache is bound at definition time to the original
method, allowing it to be patched.
"""
cache
=
linecache
.
cache
save
=
{}
for
filename
in
cache
.
keys
(
):
if
filename
[:
1
]
+
filename
[
-
1
:]
==
'<>'
:
save
[
filename
]
=
cache
[
filename
]
orig_checkcache
()
for
key
in
list
(
cache
):
if
key
[:
1
]
+
key
[
-
1
:]
==
'<>'
:
save
[
key
]
=
cache
.
pop
(
key
)
orig_checkcache
(
filename
)
cache
.
update
(
save
)
# Patch linecache.checkcache():
...
...
Lib/idlelib/run.py
Dosyayı görüntüle @
f198ac2d
...
...
@@ -25,12 +25,13 @@ except ImportError:
pass
else
:
def
idle_formatwarning_subproc
(
message
,
category
,
filename
,
lineno
,
file
=
None
,
line
=
None
):
line
=
None
):
"""Format warnings the IDLE way"""
s
=
"
\n
Warning (from warnings module):
\n
"
s
+=
' File
\"
%
s
\"
, line
%
s
\n
'
%
(
filename
,
lineno
)
line
=
linecache
.
getline
(
filename
,
lineno
)
.
strip
()
\
if
line
is
None
else
line
if
line
is
None
:
line
=
linecache
.
getline
(
filename
,
lineno
)
line
=
line
.
strip
()
if
line
:
s
+=
"
%
s
\n
"
%
line
s
+=
"
%
s:
%
s
\n
"
%
(
category
.
__name__
,
message
)
...
...
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