Skip to content

Commit 294bbf3

Browse files
committed
Replace obsolete stat module constants with
equivalent attributes in a few more spots. This closes SF patch http://www.python.org/sf/562373
1 parent c2009a8 commit 294bbf3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Lib/fileinput.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
8080
"""
8181

82-
import sys, os, stat
82+
import sys, os
8383

8484
__all__ = ["input","close","nextfile","filename","lineno","filelineno",
8585
"isfirstline","isstdin","FileInput"]
@@ -300,7 +300,7 @@ def readline(self):
300300
os.rename(self._filename, self._backupfilename)
301301
self._file = open(self._backupfilename, "r")
302302
try:
303-
perm = os.fstat(self._file.fileno())[stat.ST_MODE]
303+
perm = os.fstat(self._file.fileno()).st_mode
304304
except:
305305
self._output = open(self._filename, "w")
306306
else:

Lib/shutil.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ def copymode(src, dst):
3838
"""Copy mode bits from src to dst"""
3939
if hasattr(os, 'chmod'):
4040
st = os.stat(src)
41-
mode = stat.S_IMODE(st[stat.ST_MODE])
41+
mode = stat.S_IMODE(st.st_mode)
4242
os.chmod(dst, mode)
4343

4444
def copystat(src, dst):
4545
"""Copy all stat info (mode bits, atime and mtime) from src to dst"""
4646
st = os.stat(src)
47-
mode = stat.S_IMODE(st[stat.ST_MODE])
47+
mode = stat.S_IMODE(st.st_mode)
4848
if hasattr(os, 'utime'):
49-
os.utime(dst, (st[stat.ST_ATIME], st[stat.ST_MTIME]))
49+
os.utime(dst, (st.st_atime, st.st_mtime))
5050
if hasattr(os, 'chmod'):
5151
os.chmod(dst, mode)
5252

0 commit comments

Comments
 (0)