◐ Shell
clean mode source ↗

Message 104408 - Python tracker

Thank for the feedback.  I'll revise the patch tomorrow based on your code-cleanup suggestions.

To answer your question about the thread and explain why the test sometimes passes:

The goal of test_changing_value is to try to trigger a race condition that exists inside many of these function.  So, yes, the thread is necessary. :) Thankfully the functions call Py_BEGIN_ALLOW_THREADS; otherwise, I'd have to launch another process to try to trigger it.

Sometimes we never manage to hit the race condition and the test passes even though the bug is present.  I can increase the number of attempts to trigger it (currently "for _ in range(100)") to make it more likely to occur every time the test is run.