Skip to content

Commit baec5bc

Browse files
committed
use explicit lock
1 parent d30ace8 commit baec5bc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Modules/_threadmodule.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -809,9 +809,8 @@ iter_locked_next(PyObject *op)
809809
// we cannot use Py_BEGIN_CRITICAL_SECTION as it is not available in the normal build
810810
PyMutex_Lock(&(lz->lock));
811811

812-
PyObject *it = lz->it;
813-
result = PyIter_Next(it);
814-
if (result == NULL) {
812+
int v = PyIter_NextItem(lz->it, &result);
813+
if (v == -1) {
815814
/* Note: StopIteration is already cleared by PyIter_Next() */
816815
/* If PyErr_Occurred() we will also return NULL*/
817816
}

0 commit comments

Comments
 (0)