| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
often unavoidable.
|
|
|
|
|
| |
put more in the critical section than absolutely needed, acquire
the mutex before the "try".
|
| |
|
|
|
|
|
|
|
| |
Also, don't call gettempdir() in the default expression for the 'dir'
argument to various functions; use 'dir=None' for the default and
insert 'if dir is None: dir = gettemptir()' in the bodies. That way
the work done by gettempdir is postponed until needed.
|
|
|
|
|
|
|
|
|
|
| |
binary=True
to
text=False
by BDFL Pronouncement. All other changes follow from this. The change
to the docs is ready to go, but blocked by another JackMacLock in the
doc directory.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Although Cygwin attempts to be as Posix compliant
as possible, it has difficulties unlinking open
files. This is not surprising given that Cygwin is
dependent on Win32 which in turn has this problem
itself.
The attached tempfile patch acknowledges this
Cygwin limitation. Without this patch, Cygwin
fails test_tempfile (i.e., test_has_no_name) as
follows:
$ ./python -E -tt ../Lib/test/regrtest.py -l test_tempfile
test_tempfile
test test_tempfile failed -- Traceback (most recent call last):
File "/home/jt/src/PythonCvs/Lib/test/test_tempfile.py", line 689, in test_has_no_name
self.failOnException("rmdir", ei)
File "/home/jt/src/PythonCvs/Lib/test/test_tempfile.py", line 33, in failOnException
self.fail("%s raised %s: %s" % (what, ei[0], ei[1]))
File "/home/jt/src/PythonCvs/Lib/unittest.py", line 260, in fail
raise self.failureException, msg
AssertionError: rmdir raised exceptions.OSError: [Errno 90] Directory not empty: '/mnt/c/DOCUME~1/jatis/LOCALS~1/Temp/tmpM_z8nj'
|
|
|
|
| |
was reversed).
|
|
|
|
| |
Boolean, so changed its default value from 1 to True.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
rewrite, by Zack Weinberg). This replaces most code in tempfile.py
(please review!!!) and adds extensive unit tests for it.
This will cause some warnings in the test suite; I'll check those in
soon, and also the docs.
|
| |
|
|
|
|
| |
TemporaryFile. This flag causes the fd to be closed on exec().
|
|
|
|
| |
uses _DummyMutex on platforms without threads.
|
|
|
|
|
|
|
|
|
|
|
| |
TemproraryFileWrapper wrapper anymore, and should be immune from the
problem that a temp file inherited by a spawned process caused an
attempt to close the temp file in the spawning process to blow
up (the unlink in TemporaryFileWrapper.close() blew up with a
"Permission denied" error because, despite that the temp file got
closed in the spawning process, the spawned process still had it open
by virtue of C-level file descriptor inheritance). In context,
that bug took days to figure out <wink/sigh>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
to prevent mysterious errors at shutdown due to "os.unlink" turning into
"None.unlink".
|
|
|
|
|
| |
Ensure that a tempfile can be closed any number of times without error.
This wasn't true on Windows.
|
| |
|
|
|
|
| |
SF patch #404564, Gregor Hoffleit.
|
|
|
|
| |
giving it a slight facelift
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
pid across threads (but in that case, it's still the same process, and so
still sharing the "template" cache in tempfile.py). Repaired that, and
added a new std test.
On Linux, someone please run that standalone with more files and/or more
threads; e.g.,
python lib/test/test_threadedtempfile.py -f 1000 -t 10
to run with 10 threads each creating (and deleting) 1000 temp files.
|
|
|
|
|
|
|
| |
Tested on Windows. Should be tested on Linux. Should also be
tested on some platform without threads (I simulated that by
making the "import thread" fail, but that's not the same as
actually doing it!).
|
|
|
|
| |
This helps on 4.4BSD-based systems.
|
|
|
|
|
|
| |
This uses the same precautions when trying to find a temporary
directory as when the actual tempfile is created (using O_CREAT and
O_EXCL). On non-posix platforms, nothing is changed.
|
|
|
|
|
|
|
|
| |
The attached patches update the standard library so that all modules
have docstrings beginning with one-line summaries.
A new docstring was added to formatter. The docstring for os.py
was updated to mention nt, os2, ce in addition to posix, dos, mac.
|
|
|
|
|
|
| |
these happen to be 'closed' and 'softspace', which may change!
Noted by Dave Ascher (with slightly different solution).
|
|
|
|
|
| |
unlink() or fdopen() fail, close the file descriptor and re-raise the
exception.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
filenames generated are easily predictable, it is possible to trick an
unsuspecting program into overwriting another file by creating a
symbolic link with the predicted name. Fix this by using the
low-level os.open() function with the O_EXCL flag and mode 0700. On
non-Unix platforms, presumably there are no symbolic links so the
problem doesn't exist. The explicit test for Unix (posix, actually)
makes it possible to change the non-Unix logic to work without a
try-except clause.
The mktemp() file is as unsafe as ever.
|
|
|
|
| |
recalculated.
|
|
|
|
| |
(Jack)
|
|
|
|
|
| |
fall back to using os.curdir instead; if it is fine, don't use
os.curdir at all.
|
| |
|
|
|
|
| |
the temporary file name. Also some minor formatting of Jim F's code.
|
| |
|
|
|
|
| |
Look in more env vars (for NT: TEMP, TMP).
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
./
|
| |
|