From 5040c2994632e60d891399f4a2e755319eb8aa2f Mon Sep 17 00:00:00 2001 From: Bob Tolbert Date: Thu, 26 Dec 2013 20:46:48 -0700 Subject: [PATCH] Cleaning up some comments from berker --- docs/language/cli.rst | 4 ++++ hy/errors.py | 2 +- hy/importer.py | 5 ++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/language/cli.rst b/docs/language/cli.rst index 4bbca65..2cccd65 100644 --- a/docs/language/cli.rst +++ b/docs/language/cli.rst @@ -32,6 +32,10 @@ Command line options .. versionadded:: 0.9.11 +.. cmdoption:: --show_tracebacks + + Print extended tracebacks for Hy exceptions. + .. cmdoption:: -v Print the Hy version number and exit. diff --git a/hy/errors.py b/hy/errors.py index 2f269d5..0e786e8 100644 --- a/hy/errors.py +++ b/hy/errors.py @@ -34,7 +34,7 @@ class HyError(Exception): try: from clint.textui import colored -except: +except Exception: class colored: @staticmethod diff --git a/hy/importer.py b/hy/importer.py index 35cd685..1f8b7eb 100644 --- a/hy/importer.py +++ b/hy/importer.py @@ -75,9 +75,8 @@ def import_file_to_module(module_name, fpath): eval(ast_compile(_ast, fpath, "exec"), mod.__dict__) except (HyTypeError, LexException) as e: if e.source is None: - fp = open(fpath, 'rt') - e.source = fp.read() - fp.close() + with open(fpath, 'rt') as fp: + e.source = fp.read() e.filename = fpath raise except Exception: