Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 79ea47e

Browse files
committed
wip: use -1 for error convention for functions
1 parent 6654424 commit 79ea47e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Python/gc_free_threading.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ mark_alive_stack_push(PyObject *op, _PyObjectStack *stack)
491491
}
492492

493493
#ifdef GC_MARK_ALIVE_STACKS
494-
static bool
494+
static int
495495
gc_visit_stackref_mark_alive(_PyObjectStack *stack, _PyStackRef stackref)
496496
{
497497
// Note: we MUST check that it is deferred before checking the rest.
@@ -500,13 +500,13 @@ gc_visit_stackref_mark_alive(_PyObjectStack *stack, _PyStackRef stackref)
500500
if (PyStackRef_IsDeferred(stackref) && !PyStackRef_IsNull(stackref)) {
501501
PyObject *op = PyStackRef_AsPyObjectBorrow(stackref);
502502
if (mark_alive_stack_push(op, stack) < 0) {
503-
return false;
503+
return -1;
504504
}
505505
}
506-
return true;
506+
return 0;
507507
}
508508

509-
static bool
509+
static int
510510
gc_visit_thread_stacks_mark_alive(PyInterpreterState *interp, _PyObjectStack *stack)
511511
{
512512
_Py_FOR_EACH_TSTATE_BEGIN(interp, p) {
@@ -518,18 +518,18 @@ gc_visit_thread_stacks_mark_alive(PyInterpreterState *interp, _PyObjectStack *st
518518

519519
PyCodeObject *co = (PyCodeObject *)executable;
520520
int max_stack = co->co_nlocalsplus + co->co_stacksize;
521-
if (!gc_visit_stackref_mark_alive(stack, f->f_executable)) {
522-
return false;
521+
if (gc_visit_stackref_mark_alive(stack, f->f_executable) < 0) {
522+
return -1;
523523
}
524524
for (int i = 0; i < max_stack; i++) {
525-
if (!gc_visit_stackref_mark_alive(stack, f->localsplus[i])) {
526-
return false;
525+
if (gc_visit_stackref_mark_alive(stack, f->localsplus[i]) < 0) {
526+
return -1;
527527
}
528528
}
529529
}
530530
}
531531
_Py_FOR_EACH_TSTATE_END(interp);
532-
return true;
532+
return 0;
533533
}
534534
#endif // GC_MARK_ALIVE_STACKS
535535
#endif // GC_ENABLE_MARK_ALIVE
@@ -918,7 +918,7 @@ mark_alive_from_roots(PyInterpreterState *interp,
918918
}
919919
#endif
920920
#ifdef GC_MARK_ALIVE_STACKS
921-
if (!gc_visit_thread_stacks_mark_alive(interp, &stack)) {
921+
if (gc_visit_thread_stacks_mark_alive(interp, &stack) < 0) {
922922
return -1;
923923
}
924924
#endif

0 commit comments

Comments
 (0)