Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit b3a7011

Browse files
Anselm KruisAnselm Kruis
Anselm Kruis
authored and
Anselm Kruis
committed
Stackless issue #139: adapt compute_cr_origin() to Stackless
The new function compute_cr_origin(int origin_depth) inspects stack frames. Modify it to ignore C-frames. This fixes a segfault in test.test_asyncio.test_events.EPollEventLoopTests.test_sock_client_ops
1 parent 94d5fad commit b3a7011

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Objects/genobject.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,13 @@ compute_cr_origin(int origin_depth)
12871287
/* First count how many frames we have */
12881288
int frame_count = 0;
12891289
for (; frame && frame_count < origin_depth; ++frame_count) {
1290-
frame = frame->f_back;
1290+
#ifdef STACKLESS
1291+
do {
1292+
#endif
1293+
frame = frame->f_back;
1294+
#ifdef STACKLESS
1295+
} while (frame != NULL && !PyFrame_Check(frame));
1296+
#endif
12911297
}
12921298

12931299
/* Now collect them */
@@ -1304,7 +1310,13 @@ compute_cr_origin(int origin_depth)
13041310
return NULL;
13051311
}
13061312
PyTuple_SET_ITEM(cr_origin, i, frameinfo);
1307-
frame = frame->f_back;
1313+
#ifdef STACKLESS
1314+
do {
1315+
#endif
1316+
frame = frame->f_back;
1317+
#ifdef STACKLESS
1318+
} while (frame != NULL && !PyFrame_Check(frame));
1319+
#endif
13081320
}
13091321

13101322
return cr_origin;

0 commit comments

Comments
 (0)