Skip to content

Commit

Permalink
Always specify exception type (#1)
Browse files Browse the repository at this point in the history
An unspecified except: also catches KeyboardInterrupts and the like,
which isn't very nice :-)
  • Loading branch information
laarmen authored and jart committed Jul 3, 2016
1 parent 658aab6 commit 8ae1fc3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fabulous/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def dimensions(self):
"""
try:
call = fcntl.ioctl(self.termfd, termios.TIOCGWINSZ, "\000" * 8)
except:
except IOError:
return (79, 40)
else:
height, width = struct.unpack("hhhh", call)[:2]
Expand Down
5 changes: 3 additions & 2 deletions fabulous/xterm256.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def compile_speedup():
sauce = join(dirname(__file__), '_xterm256.c')
if not exists(library) or getmtime(sauce) > getmtime(library):
build = "gcc -fPIC -shared -o %s %s" % (library, sauce)
assert os.system(build + " >/dev/null 2>&1") == 0
if (os.system(build + " >/dev/null 2>&1") != 0):
raise OSError("GCC error")
xterm256_c = ctypes.cdll.LoadLibrary(library)
xterm256_c.init()
def xterm_to_rgb(xcolor):
Expand All @@ -102,5 +103,5 @@ def xterm_to_rgb(xcolor):

try:
(rgb_to_xterm, xterm_to_rgb) = compile_speedup()
except:
except OSError:
logging.debug("fabulous failed to compile xterm256 speedup code")

0 comments on commit 8ae1fc3

Please sign in to comment.