From e9901f325e4bfb123479c706288d5c6a09bad406 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 10 Apr 2001 15:44:33 +0000 Subject: [PATCH] Fix two unqualified except: clauses. This came out of SF bug #411881. --- Lib/posixfile.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/posixfile.py b/Lib/posixfile.py index 58c4b4f5f89..1df0cc816bf 100644 --- a/Lib/posixfile.py +++ b/Lib/posixfile.py @@ -92,16 +92,16 @@ class _posixfile_: def dup(self): import posix - try: ignore = posix.fdopen - except: raise AttributeError, 'dup() method unavailable' + if not hasattr(posix, 'fdopen'): + raise AttributeError, 'dup() method unavailable' return posix.fdopen(posix.dup(self._file_.fileno()), self._file_.mode) def dup2(self, fd): import posix - try: ignore = posix.fdopen - except: raise AttributeError, 'dup() method unavailable' + if not hasattr(posix, 'fdopen'): + raise AttributeError, 'dup() method unavailable' posix.dup2(self._file_.fileno(), fd) return posix.fdopen(fd, self._file_.mode)