New GitHub issue #118561 from colesbury:<br>

<hr>

<pre>
# Crash report

Seen in one of @swtaarrs's PRs:

```
test_racing_iter_extend (test.test_free_threading.test_list.TestList.test_racing_iter_extend) ... Fatal Python error: Segmentation fault
```

https://github.com/python/cpython/actions/runs/8942881107/job/24566423243 (crash and then success)

<details>
<summary>Logs</summary>

```
test_racing_iter_extend (test.test_free_threading.test_list.TestList.test_racing_iter_extend) ... Fatal Python error: Segmentation fault

Thread 0x00007f062affe700 (most recent call first):
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 47 in __init__
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 56 in writer_func
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 990 in run
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1039 in _bootstrap_inner
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1010 in _bootstrap

Thread 0x00007f063affe700 (most recent call first):
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 63 in reader_func
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 990 in run
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1039 in _bootstrap_inner
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1010 in _bootstrap

Thread 0x00007f063bfff700 (most recent call first):
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 61 in reader_func
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 990 in run
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1039 in _bootstrap_inner
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1010 in _bootstrap

Thread 0x00007f0649ffd700 (most recent call first):
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 63 in reader_func
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 990 in run
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1039 in _bootstrap_inner
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1010 in _bootstrap

Thread 0x00007f064affe700 (most recent call first):
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 63 in reader_func
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 990 in run
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1039 in _bootstrap_inner
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1010 in _bootstrap

  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 990 in run
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1039 in _bootstrap_inner
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1010 in _bootstrap

Thread 0x00007f0639ffd700 (most recent call first):
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 62 in reader_func
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 990 in run
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1039 in _bootstrap_inner
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1010 in _bootstrap

Thread 0x00007f062bfff700 (most recent call first):
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 62 in reader_func
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 990 in run
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1039 in _bootstrap_inner
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1010 in _bootstrap

Thread 0x00007f06cbf7c280 (most recent call first):
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/threading.py", line 1090 in join
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_free_threading/test_list.py", line 74 in test_racing_iter_extend
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/case.py", line 606 in _callTestMethod
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/case.py", line 651 in run
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/case.py", line 707 in __call__
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/suite.py", line [122](https://github.com/python/cpython/actions/runs/8942881107/job/24566423243#step:19:123) in run
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/suite.py", line 84 in __call__
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/suite.py", line 122 in run
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/suite.py", line 84 in __call__
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/suite.py", line 122 in run
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/suite.py", line 84 in __call__
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/suite.py", line 122 in run
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/suite.py", line 84 in __call__
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/unittest/runner.py", line 240 in run
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/single.py", line 57 in _run_suite
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/single.py", line 37 in run_unittest
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/single.py", line [132](https://github.com/python/cpython/actions/runs/8942881107/job/24566423243#step:19:133) in test_func
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/single.py", line 88 in regrtest_runner
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/single.py", line 135 in _load_run_test
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/single.py", line 178 in _runtest_env_changed_exc
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/single.py", line 278 in _runtest
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/single.py", line 309 in run_single_test
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/worker.py", line 77 in worker_process
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/worker.py", line 112 in main
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/libregrtest/worker.py", line 116 in <module>
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/runpy.py", line 88 in _run_code
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/runpy.py", line 198 in _run_module_as_main
```
</details>

cc @DinoV 
</pre>

<hr>

<a href="https://github.com/python/cpython/issues/118561">View on GitHub</a>
<p>Labels: tests, type-crash, topic-free-threading</p>
<p>Assignee: </p>