title: Python threads difference for 3.10 and others
body: <p>For some, simple thread related code, i.e:</p>
  <pre><code>import threading
  
  
  a = 0
  threads = []
  
  
  def x():
      global a
      for i in range(1_000_000):
          a += 1
  
  
  for _ in range(10):
      thread = threading.Thread(target=x)
      threads.append(thread)
      thread.start()
  
  
  for thread in threads:
      thread.join()
  
  
  print(a)
  assert a == 10_000_000
  </code></pre>
  <p>We got different behaviour, based on Python version.</p>
  <p>For 3.10, the output is:</p>
  <pre><code>❯ python3.10 b.py
  10000000
  </code></pre>
  <p>For 3.9, the output is:</p>
  <pre><code>❯ python3.9 b.py
  2440951
  Traceback (most recent call last):
    File &quot;/Users/romka/t/threads-test/b.py&quot;, line 24, in &lt;module&gt;
      assert a == 10_000_000
  AssertionError
  </code></pre>
  <p>As we do not acquire any lock, for me, results of 3.9 is obvious and expected. Question is why and how 3.10 got &quot;correct&quot; results, while should not?</p>
  <p>I'm review changelog for Python 3.10 and there is no anything related to threads or GIL which can bring such results.</p>