A number of bsddb tests, as well as test_tarfile, create temporary files in Lib/ or {prefix}/lib/pythonX.Y/ . This change uses tempfile.gettempdir() instead. Tested on RedHat 9.0 Linux on x86.
Committed the Lib/bsddb changes to the trunk in rev. 53264; thanks! That leaves only the tarfile change to commit, but I'd like to understand why it's necessary first.
I think the submitter is referring to the ./Lib/test/testtar.tar file, which one could guess is created when you run test_tarfile.py. But that file is distributed with Python and AFAICT, test_tarfile.py doesn't create temporary files in bad directories. So I think it is safe to close this patch.