Skip to content

Commit 8ae1fc3

Browse files
laarmenjart
authored andcommitted
Always specify exception type (#1)
An unspecified except: also catches KeyboardInterrupts and the like, which isn't very nice :-)
1 parent 658aab6 commit 8ae1fc3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

fabulous/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def dimensions(self):
9292
"""
9393
try:
9494
call = fcntl.ioctl(self.termfd, termios.TIOCGWINSZ, "\000" * 8)
95-
except:
95+
except IOError:
9696
return (79, 40)
9797
else:
9898
height, width = struct.unpack("hhhh", call)[:2]

fabulous/xterm256.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ def compile_speedup():
9191
sauce = join(dirname(__file__), '_xterm256.c')
9292
if not exists(library) or getmtime(sauce) > getmtime(library):
9393
build = "gcc -fPIC -shared -o %s %s" % (library, sauce)
94-
assert os.system(build + " >/dev/null 2>&1") == 0
94+
if (os.system(build + " >/dev/null 2>&1") != 0):
95+
raise OSError("GCC error")
9596
xterm256_c = ctypes.cdll.LoadLibrary(library)
9697
xterm256_c.init()
9798
def xterm_to_rgb(xcolor):
@@ -102,5 +103,5 @@ def xterm_to_rgb(xcolor):
102103

103104
try:
104105
(rgb_to_xterm, xterm_to_rgb) = compile_speedup()
105-
except:
106+
except OSError:
106107
logging.debug("fabulous failed to compile xterm256 speedup code")

0 commit comments

Comments
 (0)