diff options
author | Anthony Sottile <asottile@umich.edu> | 2019-02-25 22:32:27 (GMT) |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-02-25 22:32:27 (GMT) |
commit | 8377cd4fcd0d51d86834c9b0518d29aac3b49e18 (patch) | |
tree | e8d82c3567b2d39ff0bd285d25ce2d02359ae070 /Lib/tempfile.py | |
parent | 9c3f284de598550be6687964c23fd7599e53b20e (diff) | |
download | cpython-8377cd4fcd0d51d86834c9b0518d29aac3b49e18.zip cpython-8377cd4fcd0d51d86834c9b0518d29aac3b49e18.tar.gz cpython-8377cd4fcd0d51d86834c9b0518d29aac3b49e18.tar.bz2 |
Clean up code which checked presence of os.{stat,lstat,chmod} (#11643)
Diffstat (limited to 'Lib/tempfile.py')
-rw-r--r-- | Lib/tempfile.py | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py index e6fb3c8..a66d6f3 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -70,20 +70,10 @@ template = "tmp" _once_lock = _allocate_lock() -if hasattr(_os, "lstat"): - _stat = _os.lstat -elif hasattr(_os, "stat"): - _stat = _os.stat -else: - # Fallback. All we need is something that raises OSError if the - # file doesn't exist. - def _stat(fn): - fd = _os.open(fn, _os.O_RDONLY) - _os.close(fd) def _exists(fn): try: - _stat(fn) + _os.lstat(fn) except OSError: return False else: |