diff options
author | Jason Tishler <jason@tishler.net> | 2002-08-14 15:10:09 (GMT) |
---|---|---|
committer | Jason Tishler <jason@tishler.net> | 2002-08-14 15:10:09 (GMT) |
commit | 80c02af345d0f85be06422915394bbacfbd87bdb (patch) | |
tree | 1530e94ecd25e488596804c5b27fb0b6d1ab821f /Lib | |
parent | 09707e363723fa24ba53e4e5d77cc26d4dea724f (diff) | |
download | cpython-80c02af345d0f85be06422915394bbacfbd87bdb.zip cpython-80c02af345d0f85be06422915394bbacfbd87bdb.tar.gz cpython-80c02af345d0f85be06422915394bbacfbd87bdb.tar.bz2 |
Patch #595014: Cygwin tempfile patch
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'
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/tempfile.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py index fba9407..5ab5433 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -410,9 +410,9 @@ def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="", file = _os.fdopen(fd, mode, bufsize) return _TemporaryFileWrapper(file, name) -if _os.name != 'posix': - # On non-POSIX systems, assume that we cannot unlink a file while - # it is open. +if _os.name != 'posix' or _os.sys.platform == 'cygwin': + # On non-POSIX and Cygwin systems, assume that we cannot unlink a file + # while it is open. TemporaryFile = NamedTemporaryFile else: |