mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-131740: minor readability fix in PyUnstable_GC_VisitObjects (gh-131786)
Minor readability fix in PyUnstable_GC_VisitObjects Replaces `if (visit_generation())` with `if (visit_generation() < 0)`, since we are checking for the failure case, and it's confusing to have that be implicitly `true`. Also fixes a misspelt variable name.
This commit is contained in:
parent
2984ff9e51
commit
9c1e85fd64
1 changed files with 5 additions and 5 deletions
10
Python/gc.c
10
Python/gc.c
|
@ -2407,20 +2407,20 @@ void
|
||||||
PyUnstable_GC_VisitObjects(gcvisitobjects_t callback, void *arg)
|
PyUnstable_GC_VisitObjects(gcvisitobjects_t callback, void *arg)
|
||||||
{
|
{
|
||||||
GCState *gcstate = get_gc_state();
|
GCState *gcstate = get_gc_state();
|
||||||
int origenstate = gcstate->enabled;
|
int original_state = gcstate->enabled;
|
||||||
gcstate->enabled = 0;
|
gcstate->enabled = 0;
|
||||||
if (visit_generation(callback, arg, &gcstate->young)) {
|
if (visit_generation(callback, arg, &gcstate->young) < 0) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (visit_generation(callback, arg, &gcstate->old[0])) {
|
if (visit_generation(callback, arg, &gcstate->old[0]) < 0) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (visit_generation(callback, arg, &gcstate->old[1])) {
|
if (visit_generation(callback, arg, &gcstate->old[1]) < 0) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
visit_generation(callback, arg, &gcstate->permanent_generation);
|
visit_generation(callback, arg, &gcstate->permanent_generation);
|
||||||
done:
|
done:
|
||||||
gcstate->enabled = origenstate;
|
gcstate->enabled = original_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // Py_GIL_DISABLED
|
#endif // Py_GIL_DISABLED
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue