Once :func:`tee` has made a split, the original *iterable* should not be
used anywhere else; otherwise, the *iterable* could get advanced without
- the tee objects being informed. the :func:`tee` iterator can not be consumed
- from different threads, even if an underlying iterator is thread-safe.
+ the tee objects being informed.
This itertool may require significant auxiliary storage (depending on how
much temporary data needs to be stored). In general, if one iterator uses
teedataobject *dataobj;
int index; /* 0 <= index <= LINKCELLS */
PyObject *weakreflist;
- unsigned long thread_id;
} teeobject;
static PyTypeObject teedataobject_type;
{
PyObject *value, *link;
- if (to->thread_id != PyThread_get_thread_ident()) {
- PyErr_SetString(PyExc_RuntimeError,
- "tee() iterator can not be consumed from different threads.");
- return NULL;
- }
if (to->index >= LINKCELLS) {
link = teedataobject_jumplink(to->dataobj);
if (link == NULL)
newto->dataobj = to->dataobj;
newto->index = to->index;
newto->weakreflist = NULL;
- newto->thread_id = to->thread_id;
PyObject_GC_Track(newto);
return (PyObject *)newto;
}
to->index = 0;
to->weakreflist = NULL;
- to->thread_id = PyThread_get_thread_ident();
PyObject_GC_Track(to);
done:
Py_XDECREF(it);