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
f607fc53
Kaydet (Commit)
f607fc53
authored
Kas 05, 2003
tarafından
Neil Schemenauer
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add traceback.format_exc().
üst
904ed86a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
7 deletions
+22
-7
libtraceback.tex
Doc/lib/libtraceback.tex
+5
-0
threading.py
Lib/threading.py
+2
-5
traceback.py
Lib/traceback.py
+12
-2
NEWS
Misc/NEWS
+3
-0
No files found.
Doc/lib/libtraceback.tex
Dosyayı görüntüle @
f607fc53
...
...
@@ -48,6 +48,11 @@ information in a thread-safe way instead of using the deprecated
variables.)
\end{funcdesc}
\begin{funcdesc}
{
format
_
exc
}{
\optional
{
limit
\optional
{
, file
}}}
This is like
\code
{
print
_
exc(
\var
{
limit
}
)
}
but returns a string
instead of printing to a file.
\end{funcdesc}
\begin{funcdesc}
{
print
_
last
}{
\optional
{
limit
\optional
{
, file
}}}
This is a shorthand for
\code
{
print
_
exception(sys.last
_
type,
sys.last
_
value, sys.last
_
traceback,
\var
{
limit
}
,
\var
{
file
}
)
}
.
...
...
Lib/threading.py
Dosyayı görüntüle @
f607fc53
...
...
@@ -8,9 +8,8 @@ except ImportError:
del
_sys
.
modules
[
__name__
]
raise
from
StringIO
import
StringIO
as
_StringIO
from
time
import
time
as
_time
,
sleep
as
_sleep
from
traceback
import
print_exc
as
_prin
t_exc
from
traceback
import
format_exc
as
_forma
t_exc
# Rename some stuff so "from threading import *" is safe
__all__
=
[
'activeCount'
,
'Condition'
,
'currentThread'
,
'enumerate'
,
'Event'
,
...
...
@@ -440,10 +439,8 @@ class Thread(_Verbose):
except
:
if
__debug__
:
self
.
_note
(
"
%
s.__bootstrap(): unhandled exception"
,
self
)
s
=
_StringIO
()
_print_exc
(
file
=
s
)
_sys
.
stderr
.
write
(
"Exception in thread
%
s:
\n
%
s
\n
"
%
(
self
.
getName
(),
s
.
getvalue
()))
(
self
.
getName
(),
_format_exc
()))
else
:
if
__debug__
:
self
.
_note
(
"
%
s.__bootstrap(): normal return"
,
self
)
...
...
Lib/traceback.py
Dosyayı görüntüle @
f607fc53
...
...
@@ -6,8 +6,8 @@ import types
__all__
=
[
'extract_stack'
,
'extract_tb'
,
'format_exception'
,
'format_exception_only'
,
'format_list'
,
'format_stack'
,
'format_tb'
,
'print_exc'
,
'
print_exception'
,
'print_last
'
,
'print_stack'
,
'print_tb'
,
'tb_lineno'
]
'format_tb'
,
'print_exc'
,
'
format_exc'
,
'print_exception
'
,
'print_
last'
,
'print_
stack'
,
'print_tb'
,
'tb_lineno'
]
def
_print
(
file
,
str
=
''
,
terminator
=
'
\n
'
):
file
.
write
(
str
+
terminator
)
...
...
@@ -211,6 +211,16 @@ def print_exc(limit=None, file=None):
finally
:
etype
=
value
=
tb
=
None
def
format_exc
(
limit
=
None
):
"""Like print_exc() but return a string."""
try
:
etype
,
value
,
tb
=
sys
.
exc_info
()
return
''
.
join
(
format_exception
(
etype
,
value
,
tb
,
limit
))
finally
:
etype
=
value
=
tb
=
None
def
print_last
(
limit
=
None
,
file
=
None
):
"""This is a shorthand for 'print_exception(sys.last_type,
sys.last_value, sys.last_traceback, limit, file)'."""
...
...
Misc/NEWS
Dosyayı görüntüle @
f607fc53
...
...
@@ -101,6 +101,9 @@ Extension modules
Library
-------
-
traceback
.
format_exc
has
been
added
(
similar
to
print_exc
but
it
returns
a
string
).
-
xmlrpclib
.
MultiCall
has
been
added
.
-
poplib
.
POP3_SSL
has
been
added
.
...
...
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