From 7607712b61b7ab35c08e189155c0e161f9ad74b0 Mon Sep 17 00:00:00 2001 From: Sam Gross Date: Sat, 20 Dec 2025 14:42:12 -0500 Subject: [PATCH] gh-120321: Avoid `-Wunreachable-code` warning on Clang (gh-143022) --- Objects/genobject.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Objects/genobject.c b/Objects/genobject.c index 1e59d89f5ce..020af903a3f 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -422,7 +422,8 @@ gen_close(PyObject *self, PyObject *args) int8_t frame_state = FT_ATOMIC_LOAD_INT8_RELAXED(gen->gi_frame_state); do { if (frame_state == FRAME_CREATED) { - if (!_Py_GEN_TRY_SET_FRAME_STATE(gen, frame_state, FRAME_CLEARED)) { + // && (1) to avoid -Wunreachable-code warning on Clang + if (!_Py_GEN_TRY_SET_FRAME_STATE(gen, frame_state, FRAME_CLEARED) && (1)) { continue; } gen_clear_frame(gen);