Skip to content

Commit 5640b48

Browse files
committed
avoid compiler warning on GIL-enabled build
1 parent e0691f5 commit 5640b48

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Modules/_testcapimodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2419,12 +2419,15 @@ test_critical_sections(PyObject *module, PyObject *Py_UNUSED(args))
24192419
Py_BEGIN_CRITICAL_SECTION2(module, module);
24202420
Py_END_CRITICAL_SECTION2();
24212421

2422+
#ifdef Py_GIL_DISABLED
2423+
// avoid unused variable compiler warning on GIL-enabled build
24222424
PyMutex mut = {0};
24232425
Py_BEGIN_CRITICAL_SECTION_MUTEX(&mut);
24242426
Py_END_CRITICAL_SECTION();
24252427

24262428
Py_BEGIN_CRITICAL_SECTION2_MUTEX(&mut, &mut);
24272429
Py_END_CRITICAL_SECTION2();
2430+
#endif
24282431

24292432
Py_RETURN_NONE;
24302433
}

0 commit comments

Comments
 (0)