PyScopeTest.TestThread does not properly synchronize access to res and th_cnt variables.
A lock needs to be added to ensure update calls are serialized.
We should increase the number of threads to make the issue stand out if regressed.
For more details see #1022 (comment)