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
7169dbb7
Kaydet (Commit)
7169dbb7
authored
Şub 26, 1992
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Move printing of filename and lineno to tb_displayline.
Search sys.path if the filename isn't found. Include osdefs.h.
üst
0f61f8a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
20 deletions
+45
-20
traceback.c
Python/traceback.c
+45
-20
No files found.
Python/traceback.c
Dosyayı görüntüle @
7169dbb7
...
...
@@ -26,10 +26,12 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "allobjects.h"
#include "sysmodule.h"
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
#include "structmember.h"
#include "osdefs.h"
typedef
struct
_tracebackobject
{
OB_HEAD
...
...
@@ -154,21 +156,56 @@ tb_displayline(fp, filename, lineno)
int
lineno
;
{
FILE
*
xfp
;
char
buf
[
1000
];
char
line
buf
[
1000
];
int
i
;
if
(
filename
[
0
]
==
'<'
&&
filename
[
strlen
(
filename
)
-
1
]
==
'>'
)
return
;
xfp
=
fopen
(
filename
,
"r"
);
if
(
xfp
==
NULL
)
{
fprintf
(
fp
,
" (cannot open
\"
%s
\"
)
\n
"
,
filename
);
return
;
/* Search tail of filename in sys.path before giving up */
object
*
path
;
char
*
tail
=
strrchr
(
filename
,
SEP
);
if
(
tail
==
NULL
)
tail
=
filename
;
else
tail
++
;
path
=
sysget
(
"path"
);
if
(
path
!=
NULL
&&
is_listobject
(
path
))
{
int
npath
=
getlistsize
(
path
);
char
namebuf
[
MAXPATHLEN
+
1
];
for
(
i
=
0
;
i
<
npath
;
i
++
)
{
object
*
v
=
getlistitem
(
path
,
i
);
if
(
is_stringobject
(
v
))
{
int
len
;
strcpy
(
namebuf
,
getstringvalue
(
v
));
len
=
getstringsize
(
v
);
if
(
len
>
0
&&
namebuf
[
len
-
1
]
!=
SEP
)
namebuf
[
len
++
]
=
SEP
;
strcpy
(
namebuf
+
len
,
tail
);
xfp
=
fopen
(
namebuf
,
"r"
);
if
(
xfp
!=
NULL
)
{
filename
=
namebuf
;
break
;
}
}
}
}
}
fprintf
(
fp
,
" File
\"
%s
\"
"
,
filename
);
#ifdef applec
/* MPW */
/* This is needed by MPW's File and Line commands */
fprintf
(
fp
,
"; "
);
#else
/* This is needed by Emacs' compile command */
fprintf
(
fp
,
", "
);
#endif
fprintf
(
fp
,
"line %d
\n
"
,
lineno
);
if
(
xfp
==
NULL
)
return
;
for
(
i
=
0
;
i
<
lineno
;
i
++
)
{
if
(
fgets
(
buf
,
sizeof
buf
,
xfp
)
==
NULL
)
if
(
fgets
(
linebuf
,
sizeof
line
buf
,
xfp
)
==
NULL
)
break
;
}
if
(
i
==
lineno
)
{
char
*
p
=
buf
;
char
*
p
=
line
buf
;
while
(
*
p
==
' '
||
*
p
==
'\t'
)
p
++
;
fprintf
(
fp
,
" %s"
,
p
);
...
...
@@ -183,19 +220,7 @@ tb_printinternal(tb, fp)
tracebackobject
*
tb
;
FILE
*
fp
;
{
while
(
tb
!=
NULL
)
{
if
(
intrcheck
())
break
;
fprintf
(
fp
,
" File
\"
%s
\"
"
,
getstringvalue
(
tb
->
tb_frame
->
f_code
->
co_filename
));
#ifdef applec
/* MPW */
/* This is needed by MPW's File and Line commands */
fprintf
(
fp
,
"; "
);
#else
/* This is needed by Emacs' compile command */
fprintf
(
fp
,
", "
);
#endif
fprintf
(
fp
,
"line %d
\n
"
,
tb
->
tb_lineno
);
while
(
tb
!=
NULL
&&
!
intrcheck
())
{
tb_displayline
(
fp
,
getstringvalue
(
tb
->
tb_frame
->
f_code
->
co_filename
),
tb
->
tb_lineno
);
...
...
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