• Tim Peters's avatar
    SF bug #509805 tempfile.gettempdir not threadsafe · 4fd5a065
    Tim Peters yazdı
    This is an ancient race when multiple threads call gettempdir() (or
    anything relying on it) for the first time.
    
    Fixed x-platform via the Big Hammer of rearranging the code to serialize
    the first calls.  Subsequent calls are as fast as before.
    
    Note that the Python test suite can't provoke this bug:  it requires
    setting up multiple threads making the very first calls into tempfile,
    but the test suite uses tempfile several times before getting to
    test_threadedtempfile.
    
    Bugfix candidate.
    4fd5a065
tempfile.py 7.93 KB