Skip to content
Prev Previous commit
Next Next commit
Update Include/internal/pycore_critical_section.h
Use braces to restrict scope of conditional locking

Co-authored-by: Sam Gross <colesbury@gmail.com>
  • Loading branch information
MojoVampire and colesbury committed May 22, 2024
commit 0475c8eb410257559caee1a15664bacffb14528b
3 changes: 2 additions & 1 deletion Include/internal/pycore_critical_section.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ extern "C" {
&_orig_seq->ob_mutex) \

# define Py_END_CRITICAL_SECTION_SEQUENCE_FAST() \
if (_should_lock_cs) \
if (_should_lock_cs) { \
_PyCriticalSection_End(&_cs); \
} \
}

// Asserts that the mutex is locked. The mutex must be held by the
Expand Down