Skip to content

Commit 79aa580

Browse files
committed
[Jython patch #1599050] Avoid crash when os module lacks fstat()
1 parent f3caca2 commit 79aa580

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/fileinput.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,9 @@ def readline(self):
301301
self._file = open(self._backupfilename, "r")
302302
try:
303303
perm = os.fstat(self._file.fileno()).st_mode
304-
except OSError:
304+
except (AttributeError, OSError):
305+
# AttributeError occurs in Jython, where there's no
306+
# os.fstat.
305307
self._output = open(self._filename, "w")
306308
else:
307309
fd = os.open(self._filename,

0 commit comments

Comments
 (0)