Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 52941a8

Browse files
committed
Test that chmod() actually exists before calling it (it doesn't on MacOS9).
1 parent 27d19c4 commit 52941a8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Lib/fileinput.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ def readline(self):
309309
perm)
310310
self._output = os.fdopen(fd, "w")
311311
try:
312-
os.chmod(self._filename, perm)
312+
if hasattr(os, 'chmod'):
313+
os.chmod(self._filename, perm)
313314
except OSError:
314315
pass
315316
self._savestdout = sys.stdout

0 commit comments

Comments
 (0)