]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-120321: Avoid `-Wunreachable-code` warning on Clang (gh-143022)
authorSam Gross <colesbury@gmail.com>
Sat, 20 Dec 2025 19:42:12 +0000 (14:42 -0500)
committerGitHub <noreply@github.com>
Sat, 20 Dec 2025 19:42:12 +0000 (14:42 -0500)
Objects/genobject.c

index 1e59d89f5ce85fe337035806dd7cb0098a4dcdb0..020af903a3f82839763331f468731160ba39fb74 100644 (file)
@@ -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);