Skip to content

Commit 3dab9e0

Browse files
committed
gh-153062: Add a critical section to tee_copy_impl
1 parent 0563ec9 commit 3dab9e0

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Modules/itertoolsmodule.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,8 +1028,10 @@ tee_copy_impl(teeobject *to)
10281028
if (newto == NULL) {
10291029
return NULL;
10301030
}
1031+
Py_BEGIN_CRITICAL_SECTION(to);
10311032
newto->dataobj = (teedataobject *)Py_NewRef(to->dataobj);
10321033
newto->index = to->index;
1034+
Py_END_CRITICAL_SECTION();
10331035
newto->weakreflist = NULL;
10341036
newto->state = to->state;
10351037
PyObject_GC_Track(newto);

0 commit comments

Comments
 (0)