]> granicus.if.org Git - python/commit
SF bug #509805 tempfile.gettempdir not threadsafe
authorTim Peters <tim.peters@gmail.com>
Mon, 28 Jan 2002 23:11:23 +0000 (23:11 +0000)
committerTim Peters <tim.peters@gmail.com>
Mon, 28 Jan 2002 23:11:23 +0000 (23:11 +0000)
commit4fd5a06580c2b03f0252553e4024f168ea054353
treeb52b5b960c7a0b384c7fa6e22cb9c65fbe72222e
parentfea155370e00e58c694392dd79d47e9481897b4f
SF bug #509805 tempfile.gettempdir not threadsafe
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.
Lib/tempfile.py