From: Andrew M. Kuchling Date: Wed, 22 Nov 2006 19:50:21 +0000 (+0000) Subject: [Jython patch #1599050] Avoid crash when os module lacks fstat() X-Git-Tag: v2.3.7c1~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=79aa58053785696b5e8f4bb3f2480cb5181fe76e;p=thirdparty%2FPython%2Fcpython.git [Jython patch #1599050] Avoid crash when os module lacks fstat() --- diff --git a/Lib/fileinput.py b/Lib/fileinput.py index 27ccc3bfedfd..75938585793a 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,