Skip to content

Instantly share code, notes, and snippets.

@devdanzin
Last active July 17, 2026 17:04
Show Gist options
  • Select an option

  • Save devdanzin/db21f2b29ab7572ce6c111b57b3cea5c to your computer and use it in GitHub Desktop.

Select an option

Save devdanzin/db21f2b29ab7572ce6c111b57b3cea5c to your computer and use it in GitHub Desktop.
TSAN-0006: itertools: concurrent repr() of a shared count() races count_repr's plain read of lz->cnt against count_next's atomic advance

Data race: itertools.count().__repr__ reads the counter non-atomically while __next__ advances it atomically (itertoolsmodule.c:3612)

In the free-threaded build, count_next advances a fast-mode count()'s counter lz->cnt with an atomic compare-exchange (itertoolsmodule.c:3599), but count_repr reads that same field with a plain, non-atomic load (itertoolsmodule.c:3612). Concurrently repr()-ing a shared count() while another thread calls next() on it is a data race: an atomic store racing a non-atomic load on lz->cnt. repr() looks read-only to callers, so a shared count() is not safe to display while it advances.

AI Disclaimer: this report was drafted by Claude Code, which also created and ran the reproducer; the maintainer reviewed and edited it.

Tracked in the umbrella issue python/cpython#153852 — one of a batch of free-threading data races found with fusil --tsan.

Summary

itertools.count() keeps its fast-mode counter in the plain C field countobject.cnt (Py_ssize_t). The free-threaded count_next was hardened to advance it with a lock-free CAS loop over relaxed atomics:

static PyObject *
count_next(PyObject *op)
{
    countobject *lz = countobject_CAST(op);
#else /* Py_GIL_DISABLED */
    Py_ssize_t cnt;
    cnt = _Py_atomic_load_ssize_relaxed(&lz->cnt);        /* :3591 atomic load  */
    for (;;) {
        if (cnt == PY_SSIZE_T_MAX) { ... }                /* slow-mode fallback */
        if (_Py_atomic_compare_exchange_ssize(&lz->cnt, &cnt, cnt + 1))  /* :3599 atomic write */
            return PyLong_FromSsize_t(cnt);
    }
#endif
}

But count_repr was not updated to match -- it reads the same field with an ordinary C load:

static PyObject *
count_repr(PyObject *op)
{
    countobject *lz = countobject_CAST(op);
    if (lz->long_cnt == NULL)
        return PyUnicode_FromFormat("%s(%zd)",
                                    _PyType_Name(Py_TYPE(lz)), lz->cnt);  /* :3612 plain read */
    ...
}

Two threads sharing one count() -- one calling repr(c), another calling next(c) -- race on lz->cnt: count_repr's plain 8-byte load at :3612:68 vs count_next's atomic 8-byte store at :3599. Under C11/TSan semantics a non-atomic access concurrent with an atomic access to the same location is a data race (and technically UB). It is value-benign in practice (aligned 8-byte word, no torn read on x86-64; repr just prints a slightly stale count), but it is a genuine TSan-reported race on an operation callers treat as read-only.

Reproducer

import sys, threading, itertools
assert not sys._is_gil_enabled(), "run free-threaded: PYTHON_GIL=0"

# A fast-mode itertools.count() keeps its counter in the plain C field lz->cnt.
# count_next() advances it with an ATOMIC compare-exchange, but count_repr()
# reads the very same field with a PLAIN (non-atomic) load. Sharing one count()
# across threads -- some calling next(c), some calling repr(c) -- races the plain
# read in count_repr against the atomic write in count_next on lz->cnt.
NT = 6                    # worker threads (half repr, half next)
ROUNDS = 4000
pool = [None]
enter = threading.Barrier(NT + 1)
leave = threading.Barrier(NT + 1)

def repr_worker():
    for _ in range(ROUNDS):
        enter.wait()
        for c in pool[0]:
            repr(c)          # count_repr: plain read of lz->cnt (itertoolsmodule.c:3612)
        leave.wait()

def next_worker():
    for _ in range(ROUNDS):
        enter.wait()
        for c in pool[0]:
            next(c)          # count_next: atomic CAS write of lz->cnt (itertoolsmodule.c:3599)
        leave.wait()

ts = [threading.Thread(target=repr_worker) for _ in range(NT // 2)]
ts += [threading.Thread(target=next_worker) for _ in range(NT - NT // 2)]
for t in ts: t.start()
for r in range(ROUNDS):
    pool[0] = [itertools.count() for _ in range(64)]   # fresh, fast-mode counts each round
    enter.wait(); leave.wait()
for t in ts: t.join()
print("done, no crash")

Run (free-threaded + TSan build):

DEBUGINFOD_URLS= PYTHON_GIL=0 TSAN_OPTIONS="halt_on_error=1:symbolize=1:history_size=4" \
  setarch -R ./python repro.py

TSan report (confirmed, CPython 3.16.0a0 --disable-gil --with-thread-sanitizer, debug-ft-nojit-tsan)

WARNING: ThreadSanitizer: data race
  Atomic write of size 8 at 0x... by thread T4:
    #0 _Py_atomic_compare_exchange_ssize Include/cpython/pyatomic_gcc.h:130:10
    #1 count_next   Modules/itertoolsmodule.c:3599:13   (CAS lz->cnt = cnt + 1)
    #2 builtin_next Python/bltinmodule.c:1776:11
    ...
    #27 thread_run  Modules/_threadmodule.c:388:21

  Previous read of size 8 at 0x... by thread T2:
    #0 count_repr    Modules/itertoolsmodule.c:3612:68   (read lz->cnt)
    #1 PyObject_Repr Objects/object.c:784:11
    #2 builtin_repr  Python/bltinmodule.c:2677:12
    ...
    #30 thread_run   Modules/_threadmodule.c:388:21

SUMMARY: ThreadSanitizer: data race Modules/itertoolsmodule.c:3612:68 in count_repr

Reproduces deterministically (exit 66) and does not crash. The racing pair is always count_repr (plain read of lz->cnt, :3612:68) vs count_next (atomic write of lz->cnt, :3599). TSan's SUMMARY names whichever side it reports as the "current" access, so it alternates between count_repr:3612 (the seeded signature) and _Py_atomic_compare_exchange_ssize / count_next:3599 across runs -- same race either way. This is the exact signature auto-seeded by fusil --tsan in fleet 01 (the vehicle's op-mix ran list(c) -- which drives count_next the same way -- concurrently with repr(c)).

Root cause

The free-threading conversion of count made the writer (count_next) atomic on lz->cnt -- a relaxed atomic load at :3591 plus a _Py_atomic_compare_exchange_ssize at :3599 -- but left the reader in count_repr as a plain field access (:3612). C11's memory model (and TSan) require every access to a location that is atomically written to also be atomic; a plain load concurrent with an atomic store is a data race. The object presents repr() as read-only, so callers reasonably assume it is safe to display a shared count() while another thread advances it -- but the hidden plain read of cnt breaks that.

(The count() object is otherwise partly hardened for free-threading: the fast->slow transition and count_nextlong in count_next run under Py_BEGIN_CRITICAL_SECTION(lz). Only count_repr's fast-mode cnt read was missed. In fast mode lz->long_cnt stays NULL, so count_repr's :3610 long_cnt == NULL branch is stable -- the sole reported race is the cnt field.)

Impact / severity

Low. Value-benign and crash-free: lz->cnt is a single aligned Py_ssize_t, so there is no torn read on mainstream 64-bit platforms; the worst observable effect is repr() printing a slightly stale counter value. But it is a real, TSan-reported data race (technically UB) on an API callers treat as read-only, and it is trivially triggered by sharing a count() across threads. No use-after-free or memory-safety consequence.

Suggested fix

Read lz->cnt in count_repr with the same relaxed atomic that count_next already uses on the field, so the read/write pair is well-defined and TSan-clean (the value is a plain counter, so relaxed ordering suffices):

static PyObject *
count_repr(PyObject *op)
{
    countobject *lz = countobject_CAST(op);
    if (lz->long_cnt == NULL)
        return PyUnicode_FromFormat("%s(%zd)", _PyType_Name(Py_TYPE(lz)),
                                    _Py_atomic_load_ssize_relaxed(&lz->cnt));  /* was: lz->cnt */
    ...
}

(FT_ATOMIC_LOAD_SSIZE_RELAXED / _Py_atomic_load_ssize_relaxed is the existing wrapper for exactly this; count_next already loads the field this way at :3591.)

Notes

Found by ThreadSanitizer fuzzing (fusil --tsan, fleet 01). Low severity (value-benign, crash-free), but a real free-threading data race left by an incomplete atomic conversion -- the writer was made atomic and the reader was not. The same "atomic write, plain read" asymmetry should be audited across the other partially-hardened itertools objects (any field where _Py_atomic_* is used on one path but read plainly on another).


Part of an upcoming umbrella issue tracking free-threading data races found by fusil --tsan. Not yet individually filed.

import sys, threading, itertools
assert not sys._is_gil_enabled(), "run free-threaded: PYTHON_GIL=0"
# A fast-mode itertools.count() keeps its counter in the plain C field lz->cnt.
# count_next() advances it with an ATOMIC compare-exchange (_Py_atomic_compare_exchange_ssize),
# but count_repr() reads the very same field with a PLAIN (non-atomic) load.
# Sharing one count() object across threads -- some calling next(c), some calling repr(c) --
# races the plain read in count_repr against the atomic write in count_next on lz->cnt.
NT = 6 # worker threads (half repr, half next)
ROUNDS = 4000
pool = [None]
enter = threading.Barrier(NT + 1)
leave = threading.Barrier(NT + 1)
def repr_worker():
for _ in range(ROUNDS):
enter.wait()
for c in pool[0]:
repr(c) # count_repr: plain read of lz->cnt (itertoolsmodule.c:3612)
leave.wait()
def next_worker():
for _ in range(ROUNDS):
enter.wait()
for c in pool[0]:
next(c) # count_next: atomic CAS write of lz->cnt (itertoolsmodule.c:3599)
leave.wait()
ts = [threading.Thread(target=repr_worker) for _ in range(NT // 2)]
ts += [threading.Thread(target=next_worker) for _ in range(NT - NT // 2)]
for t in ts: t.start()
for r in range(ROUNDS):
pool[0] = [itertools.count() for _ in range(64)] # fresh, fast-mode counts each round
enter.wait() # release workers onto the fresh batch
leave.wait() # wait for them to finish this batch
for t in ts: t.join()
print("done, no crash")
WARNING: ThreadSanitizer: data race (pid=1869702)
Read of size 8 at 0x7fffb65cc090 by thread T2:
#0 count_repr Modules/itertoolsmodule.c:3612:68 (python+0x7a75b7) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#1 PyObject_Repr Objects/object.c:784:11 (python+0x37d2f7) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#2 builtin_repr Python/bltinmodule.c:2677:12 (python+0x52ef6d) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#3 cfunction_vectorcall_O Objects/methodobject.c:536:24 (python+0x36fec2) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#4 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#5 PyObject_Vectorcall Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#6 _Py_VectorCallInstrumentation_StackRefSteal Python/ceval.c:768:11 (python+0x536b24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#7 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1906:35 (python+0x5662d0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#8 _PyEval_EvalFrame Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#9 _PyEval_Vector Python/ceval.c:2171:12 (python+0x53601c)
#10 _PyFunction_Vectorcall Objects/call.c (python+0x296ba6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#11 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#12 _PyObject_VectorcallPrepend Objects/call.c:855:20 (python+0x298682) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#13 method_vectorcall Objects/classobject.c:55:12 (python+0x29b26a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#14 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x5b472a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#15 context_run Python/context.c:731:29 (python+0x5b472a)
#16 method_vectorcall_FASTCALL_KEYWORDS Objects/descrobject.c:421:24 (python+0x2b4ff6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#17 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#18 PyObject_Vectorcall Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#19 _Py_VectorCallInstrumentation_StackRefSteal Python/ceval.c:768:11 (python+0x536b24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#20 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1906:35 (python+0x5662d0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#21 _PyEval_EvalFrame Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#22 _PyEval_Vector Python/ceval.c:2171:12 (python+0x53601c)
#23 _PyFunction_Vectorcall Objects/call.c (python+0x296ba6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#24 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#25 _PyObject_VectorcallPrepend Objects/call.c:855:20 (python+0x298682) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#26 method_vectorcall Objects/classobject.c:55:12 (python+0x29b26a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#27 _PyVectorcall_Call Objects/call.c:273:16 (python+0x296512) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#28 _PyObject_Call Objects/call.c:348:16 (python+0x296785) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#29 PyObject_Call Objects/call.c:373:12 (python+0x2969a7) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#30 thread_run Modules/_threadmodule.c:388:21 (python+0x7e0778) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#31 pythread_wrapper Python/thread_pthread.h:234:5 (python+0x6cd55b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
Previous atomic write of size 8 at 0x7fffb65cc090 by thread T1:
#0 _Py_atomic_compare_exchange_ssize Include/cpython/pyatomic_gcc.h:130:10 (python+0x7a76ee) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#1 count_next Modules/itertoolsmodule.c:3599:13 (python+0x7a76ee)
#2 list_extend_iter_lock_held Objects/listobject.c:1318:26 (python+0x30f9a5) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#3 _list_extend Objects/listobject.c:1507:15 (python+0x3080f7) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#4 list___init___impl Objects/listobject.c:3539:13 (python+0x316d92) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#5 list_vectorcall Objects/listobject.c:3563:13 (python+0x30d2a0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#6 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#7 PyObject_Vectorcall Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#8 _Py_VectorCallInstrumentation_StackRefSteal Python/ceval.c:768:11 (python+0x536b24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#9 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1906:35 (python+0x5662d0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#10 _PyEval_EvalFrame Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#11 _PyEval_Vector Python/ceval.c:2171:12 (python+0x53601c)
#12 _PyFunction_Vectorcall Objects/call.c (python+0x296ba6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#13 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#14 _PyObject_VectorcallPrepend Objects/call.c:855:20 (python+0x298682) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#15 method_vectorcall Objects/classobject.c:55:12 (python+0x29b26a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#16 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x5b472a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#17 context_run Python/context.c:731:29 (python+0x5b472a)
#18 method_vectorcall_FASTCALL_KEYWORDS Objects/descrobject.c:421:24 (python+0x2b4ff6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#19 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#20 PyObject_Vectorcall Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#21 _Py_VectorCallInstrumentation_StackRefSteal Python/ceval.c:768:11 (python+0x536b24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#22 _PyEval_EvalFrameDefault Python/generated_cases.c.h:1906:35 (python+0x5662d0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#23 _PyEval_EvalFrame Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#24 _PyEval_Vector Python/ceval.c:2171:12 (python+0x53601c)
#25 _PyFunction_Vectorcall Objects/call.c (python+0x296ba6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#26 _PyObject_VectorcallTstate Include/internal/pycore_call.h:144:11 (python+0x294b28) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#27 _PyObject_VectorcallPrepend Objects/call.c:855:20 (python+0x298682) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#28 method_vectorcall Objects/classobject.c:55:12 (python+0x29b26a) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#29 _PyVectorcall_Call Objects/call.c:273:16 (python+0x296512) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#30 _PyObject_Call Objects/call.c:348:16 (python+0x296785) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#31 PyObject_Call Objects/call.c:373:12 (python+0x2969a7) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#32 thread_run Modules/_threadmodule.c:388:21 (python+0x7e0778) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#33 pythread_wrapper Python/thread_pthread.h:234:5 (python+0x6cd55b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
Thread T2 'tsan_0_1' (tid=1869713, running) created by main thread at:
#0 pthread_create <null> (python+0xfff0e) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#1 do_start_joinable_thread Python/thread_pthread.h:281:14 (python+0x6cc22b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#2 PyThread_start_joinable_thread Python/thread_pthread.h:323:9 (python+0x6cc024) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#3 ThreadHandle_start Modules/_threadmodule.c:475:9 (python+0x7e0237) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#4 do_start_new_thread Modules/_threadmodule.c:1919:9 (python+0x7e0237)
#5 thread_PyThread_start_joinable_thread Modules/_threadmodule.c:2042:14 (python+0x7de480) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#6 cfunction_call Objects/methodobject.c:564:18 (python+0x370f23) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#7 _PyObject_MakeTpCall Objects/call.c:242:18 (python+0x29522c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#8 _PyObject_VectorcallTstate Include/internal/pycore_call.h:142:16 (python+0x294b69) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#9 PyObject_Vectorcall Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#10 _Py_VectorCall_StackRefSteal Python/ceval.c:726:11 (python+0x53636b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#11 _PyEval_EvalFrameDefault Python/generated_cases.c.h:3686:35 (python+0x54f032) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#12 _PyEval_EvalFrame Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#13 _PyEval_Vector Python/ceval.c:2171:12 (python+0x53601c)
#14 PyEval_EvalCode Python/ceval.c:679:21 (python+0x5358a1) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#15 run_eval_code_obj Python/pythonrun.c:1369:12 (python+0x69ef1f) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#16 run_mod Python/pythonrun.c:1472:19 (python+0x69eab2) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#17 pyrun_file Python/pythonrun.c:1296:15 (python+0x69a4e1) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#18 _PyRun_SimpleFileObject Python/pythonrun.c:518:13 (python+0x698aca) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#19 _PyRun_AnyFileObject Python/pythonrun.c:81:15 (python+0x6981a6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#20 pymain_run_file_obj Modules/main.c:411:15 (python+0x6ee3ad) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#21 pymain_run_file Modules/main.c:430:15 (python+0x6ee3ad)
#22 pymain_run_python Modules/main.c:715:21 (python+0x6ed206) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#23 Py_RunMain Modules/main.c:796:5 (python+0x6ed206)
#24 pymain_main Modules/main.c:826:12 (python+0x6ed977) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#25 Py_BytesMain Modules/main.c:850:12 (python+0x6eda24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#26 main Programs/python.c:15:12 (python+0x184cc0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
Thread T1 'tsan_0_0' (tid=1869712, running) created by main thread at:
#0 pthread_create <null> (python+0xfff0e) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#1 do_start_joinable_thread Python/thread_pthread.h:281:14 (python+0x6cc22b) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#2 PyThread_start_joinable_thread Python/thread_pthread.h:323:9 (python+0x6cc024) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#3 ThreadHandle_start Modules/_threadmodule.c:475:9 (python+0x7e0237) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#4 do_start_new_thread Modules/_threadmodule.c:1919:9 (python+0x7e0237)
#5 thread_PyThread_start_joinable_thread Modules/_threadmodule.c:2042:14 (python+0x7de480) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#6 cfunction_call Objects/methodobject.c:564:18 (python+0x370f23) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#7 _PyObject_MakeTpCall Objects/call.c:242:18 (python+0x29522c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#8 _PyObject_VectorcallTstate Include/internal/pycore_call.h:142:16 (python+0x294b69) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#9 PyObject_Vectorcall Objects/call.c:327:12 (python+0x296660) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#10 _Py_VectorCallInstrumentation_StackRefSteal Python/ceval.c:768:11 (python+0x536b24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#11 _PyEval_EvalFrameDefault Python/generated_cases.c.h:3474:35 (python+0x562e75) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#12 _PyEval_EvalFrame Include/internal/pycore_ceval.h:122:16 (python+0x53601c) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#13 _PyEval_Vector Python/ceval.c:2171:12 (python+0x53601c)
#14 PyEval_EvalCode Python/ceval.c:679:21 (python+0x5358a1) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#15 run_eval_code_obj Python/pythonrun.c:1369:12 (python+0x69ef1f) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#16 run_mod Python/pythonrun.c:1472:19 (python+0x69eab2) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#17 pyrun_file Python/pythonrun.c:1296:15 (python+0x69a4e1) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#18 _PyRun_SimpleFileObject Python/pythonrun.c:518:13 (python+0x698aca) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#19 _PyRun_AnyFileObject Python/pythonrun.c:81:15 (python+0x6981a6) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#20 pymain_run_file_obj Modules/main.c:411:15 (python+0x6ee3ad) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#21 pymain_run_file Modules/main.c:430:15 (python+0x6ee3ad)
#22 pymain_run_python Modules/main.c:715:21 (python+0x6ed206) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#23 Py_RunMain Modules/main.c:796:5 (python+0x6ed206)
#24 pymain_main Modules/main.c:826:12 (python+0x6ed977) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#25 Py_BytesMain Modules/main.c:850:12 (python+0x6eda24) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
#26 main Programs/python.c:15:12 (python+0x184cc0) (BuildId: 210f4dee1678f3b37d4df3e6b4d2f870b5f45e9c)
SUMMARY: ThreadSanitizer: data race Modules/itertoolsmodule.c:3612:68 in count_repr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment