Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit58e334e

Browse files
authored
gh-123967: Fix faulthandler for trampoline frames (#127329)
If the top-most frame is a trampoline frame, skip it.
1 parent9328db7 commit58e334e

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix faulthandler for trampoline frames. If the top-most frame is a
2+
trampoline frame, skip it. Patch by Victor Stinner.

‎Python/traceback.c‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,8 @@ _Py_DumpASCII(int fd, PyObject *text)
890890
staticvoid
891891
dump_frame(intfd,_PyInterpreterFrame*frame)
892892
{
893+
assert(frame->owner!=FRAME_OWNED_BY_CSTACK);
894+
893895
PyCodeObject*code=_PyFrame_GetCode(frame);
894896
PUTS(fd," File ");
895897
if (code->co_filename!=NULL
@@ -963,6 +965,17 @@ dump_traceback(int fd, PyThreadState *tstate, int write_header)
963965

964966
unsignedintdepth=0;
965967
while (1) {
968+
if (frame->owner==FRAME_OWNED_BY_CSTACK) {
969+
/* Trampoline frame */
970+
frame=frame->previous;
971+
if (frame==NULL) {
972+
break;
973+
}
974+
975+
/* Can't have more than one shim frame in a row */
976+
assert(frame->owner!=FRAME_OWNED_BY_CSTACK);
977+
}
978+
966979
if (MAX_FRAME_DEPTH <=depth) {
967980
if (MAX_FRAME_DEPTH<depth) {
968981
PUTS(fd,"plus ");
@@ -971,20 +984,12 @@ dump_traceback(int fd, PyThreadState *tstate, int write_header)
971984
}
972985
break;
973986
}
987+
974988
dump_frame(fd,frame);
975989
frame=frame->previous;
976990
if (frame==NULL) {
977991
break;
978992
}
979-
if (frame->owner==FRAME_OWNED_BY_CSTACK) {
980-
/* Trampoline frame */
981-
frame=frame->previous;
982-
}
983-
if (frame==NULL) {
984-
break;
985-
}
986-
/* Can't have more than one shim frame in a row */
987-
assert(frame->owner!=FRAME_OWNED_BY_CSTACK);
988993
depth++;
989994
}
990995
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp