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
a7604bf1
Kaydet (Commit)
a7604bf1
authored
Mar 21, 2004
tarafından
Nicholas Bastin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Moved tracebackobject to traceback.h, Closes SF Bug #497067
üst
8183fa46
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
24 deletions
+27
-24
traceback.h
Include/traceback.h
+9
-1
NEWS
Misc/NEWS
+2
-0
traceback.c
Python/traceback.c
+16
-23
No files found.
Include/traceback.h
Dosyayı görüntüle @
a7604bf1
...
...
@@ -5,9 +5,17 @@
extern
"C"
{
#endif
struct
_frame
;
/* Traceback interface */
struct
_frame
;
typedef
struct
_traceback
{
PyObject_HEAD
struct
_traceback
*
tb_next
;
struct
_frame
*
tb_frame
;
int
tb_lasti
;
int
tb_lineno
;
}
PyTracebackObject
;
PyAPI_FUNC
(
int
)
PyTraceBack_Here
(
struct
_frame
*
);
PyAPI_FUNC
(
int
)
PyTraceBack_Print
(
PyObject
*
,
PyObject
*
);
...
...
Misc/NEWS
Dosyayı görüntüle @
a7604bf1
...
...
@@ -12,6 +12,8 @@ What's New in Python 2.4 alpha 1?
Core and builtins
-----------------
- Moved tracebackobject into traceback.h and renamed to PyTracebackObject
- Optimized the byte coding for multiple assignments like "a,b=b,a" and
"a,b,c=1,2,3". Improves their speed by 25% to 30%.
...
...
Python/traceback.c
Dosyayı görüntüle @
a7604bf1
...
...
@@ -7,16 +7,9 @@
#include "frameobject.h"
#include "structmember.h"
#include "osdefs.h"
#include "traceback.h"
typedef
struct
_tracebackobject
{
PyObject_HEAD
struct
_tracebackobject
*
tb_next
;
PyFrameObject
*
tb_frame
;
int
tb_lasti
;
int
tb_lineno
;
}
tracebackobject
;
#define OFF(x) offsetof(tracebackobject, x)
#define OFF(x) offsetof(PyTracebackObject, x)
static
struct
memberlist
tb_memberlist
[]
=
{
{
"tb_next"
,
T_OBJECT
,
OFF
(
tb_next
)},
...
...
@@ -27,13 +20,13 @@ static struct memberlist tb_memberlist[] = {
};
static
PyObject
*
tb_getattr
(
tracebacko
bject
*
tb
,
char
*
name
)
tb_getattr
(
PyTracebackO
bject
*
tb
,
char
*
name
)
{
return
PyMember_Get
((
char
*
)
tb
,
tb_memberlist
,
name
);
}
static
void
tb_dealloc
(
tracebacko
bject
*
tb
)
tb_dealloc
(
PyTracebackO
bject
*
tb
)
{
PyObject_GC_UnTrack
(
tb
);
Py_TRASHCAN_SAFE_BEGIN
(
tb
)
...
...
@@ -44,7 +37,7 @@ tb_dealloc(tracebackobject *tb)
}
static
int
tb_traverse
(
tracebacko
bject
*
tb
,
visitproc
visit
,
void
*
arg
)
tb_traverse
(
PyTracebackO
bject
*
tb
,
visitproc
visit
,
void
*
arg
)
{
int
err
=
0
;
if
(
tb
->
tb_next
)
{
...
...
@@ -58,7 +51,7 @@ tb_traverse(tracebackobject *tb, visitproc visit, void *arg)
}
static
void
tb_clear
(
tracebacko
bject
*
tb
)
tb_clear
(
PyTracebackO
bject
*
tb
)
{
Py_XDECREF
(
tb
->
tb_next
);
Py_XDECREF
(
tb
->
tb_frame
);
...
...
@@ -70,7 +63,7 @@ PyTypeObject PyTraceBack_Type = {
PyObject_HEAD_INIT
(
&
PyType_Type
)
0
,
"traceback"
,
sizeof
(
tracebacko
bject
),
sizeof
(
PyTracebackO
bject
),
0
,
(
destructor
)
tb_dealloc
,
/*tp_dealloc*/
0
,
/*tp_print*/
...
...
@@ -102,16 +95,16 @@ PyTypeObject PyTraceBack_Type = {
0
,
/* tp_dict */
};
static
tracebacko
bject
*
newtracebackobject
(
tracebacko
bject
*
next
,
PyFrameObject
*
frame
)
static
PyTracebackO
bject
*
newtracebackobject
(
PyTracebackO
bject
*
next
,
PyFrameObject
*
frame
)
{
tracebacko
bject
*
tb
;
PyTracebackO
bject
*
tb
;
if
((
next
!=
NULL
&&
!
PyTraceBack_Check
(
next
))
||
frame
==
NULL
||
!
PyFrame_Check
(
frame
))
{
PyErr_BadInternalCall
();
return
NULL
;
}
tb
=
PyObject_GC_New
(
tracebacko
bject
,
&
PyTraceBack_Type
);
tb
=
PyObject_GC_New
(
PyTracebackO
bject
,
&
PyTraceBack_Type
);
if
(
tb
!=
NULL
)
{
Py_XINCREF
(
next
);
tb
->
tb_next
=
next
;
...
...
@@ -129,8 +122,8 @@ int
PyTraceBack_Here
(
PyFrameObject
*
frame
)
{
PyThreadState
*
tstate
=
frame
->
f_tstate
;
tracebackobject
*
oldtb
=
(
tracebacko
bject
*
)
tstate
->
curexc_traceback
;
tracebacko
bject
*
tb
=
newtracebackobject
(
oldtb
,
frame
);
PyTracebackObject
*
oldtb
=
(
PyTracebackO
bject
*
)
tstate
->
curexc_traceback
;
PyTracebackO
bject
*
tb
=
newtracebackobject
(
oldtb
,
frame
);
if
(
tb
==
NULL
)
return
-
1
;
tstate
->
curexc_traceback
=
(
PyObject
*
)
tb
;
...
...
@@ -222,11 +215,11 @@ tb_displayline(PyObject *f, char *filename, int lineno, char *name)
}
static
int
tb_printinternal
(
tracebacko
bject
*
tb
,
PyObject
*
f
,
int
limit
)
tb_printinternal
(
PyTracebackO
bject
*
tb
,
PyObject
*
f
,
int
limit
)
{
int
err
=
0
;
int
depth
=
0
;
tracebacko
bject
*
tb1
=
tb
;
PyTracebackO
bject
*
tb1
=
tb
;
while
(
tb1
!=
NULL
)
{
depth
++
;
tb1
=
tb1
->
tb_next
;
...
...
@@ -267,6 +260,6 @@ PyTraceBack_Print(PyObject *v, PyObject *f)
}
err
=
PyFile_WriteString
(
"Traceback (most recent call last):
\n
"
,
f
);
if
(
!
err
)
err
=
tb_printinternal
((
tracebacko
bject
*
)
v
,
f
,
limit
);
err
=
tb_printinternal
((
PyTracebackO
bject
*
)
v
,
f
,
limit
);
return
err
;
}
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