]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[Jython patch #1599050] Avoid crash when os module lacks fstat()
authorAndrew M. Kuchling <amk@amk.ca>
Wed, 22 Nov 2006 19:50:21 +0000 (19:50 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Wed, 22 Nov 2006 19:50:21 +0000 (19:50 +0000)
Lib/fileinput.py

index 27ccc3bfedfd7a5b2584258b86228f4df2f89c78..75938585793aa2924304aeb4baf784ea29622428 100644 (file)
@@ -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,