diff options
author | Charles-François Natali <neologix@free.fr> | 2011-07-29 17:00:38 (GMT) |
---|---|---|
committer | Charles-François Natali <neologix@free.fr> | 2011-07-29 17:00:38 (GMT) |
commit | e12c0b1767309ec1fe727e91f8d4c0cfae4a88a8 (patch) | |
tree | d9d106ff50730f60120133eb3a43158129228245 /Lib/tempfile.py | |
parent | 516c51c14c06913ac832b0f50989e83c6f3bb730 (diff) | |
parent | def35435ee4001f8aedac01b559bb0dc2d0aab00 (diff) | |
download | cpython-e12c0b1767309ec1fe727e91f8d4c0cfae4a88a8.zip cpython-e12c0b1767309ec1fe727e91f8d4c0cfae4a88a8.tar.gz cpython-e12c0b1767309ec1fe727e91f8d4c0cfae4a88a8.tar.bz2 |
Issue #12464: tempfile.TemporaryDirectory.cleanup() should not follow symlinks:
fix it. Patch by Petri Lehtinen.
Diffstat (limited to 'Lib/tempfile.py')
-rw-r--r-- | Lib/tempfile.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py index b7439a2..a450003 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -661,6 +661,7 @@ class TemporaryDirectory(object): _listdir = staticmethod(_os.listdir) _path_join = staticmethod(_os.path.join) _isdir = staticmethod(_os.path.isdir) + _islink = staticmethod(_os.path.islink) _remove = staticmethod(_os.remove) _rmdir = staticmethod(_os.rmdir) _os_error = _os.error @@ -672,7 +673,7 @@ class TemporaryDirectory(object): for name in self._listdir(path): fullname = self._path_join(path, name) try: - isdir = self._isdir(fullname) + isdir = self._isdir(fullname) and not self._islink(fullname) except self._os_error: isdir = False if isdir: |