From 79aa58053785696b5e8f4bb3f2480cb5181fe76e Mon Sep 17 00:00:00 2001 From: "Andrew M. Kuchling" Date: Wed, 22 Nov 2006 19:50:21 +0000 Subject: [Jython patch #1599050] Avoid crash when os module lacks fstat() --- Lib/fileinput.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/fileinput.py b/Lib/fileinput.py index 27ccc3b..7593858 100644 --- a/Lib/fileinput.py +++ b/Lib/fileinput.py @@ -301,7 +301,9 @@ class FileInput: self._file = open(self._backupfilename, "r") try: perm = os.fstat(self._file.fileno()).st_mode - except OSError: + except (AttributeError, OSError): + # AttributeError occurs in Jython, where there's no + # os.fstat. self._output = open(self._filename, "w") else: fd = os.open(self._filename, -- cgit v0.12