gh-120321: Avoid -Wunreachable-code warning on Clang (gh-143022)

This commit is contained in:
Sam Gross 2025-12-20 14:42:12 -05:00 committed by GitHub
parent 3cc57505e5
commit 7607712b61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View 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);