# Buggy code
def runsource(self, source, filename="<input>", symbol="single"):
    global SIMPLE_TRACEBACKS
    try:
        try:
            do = import_buffer_to_hst(source)
        except PrematureEndOfInput:
            return True
    except LexException as e:
        if e.source is None:
            e.source = source
            e.filename = filename
        print(e, file=sys.stderr)
        return False

    try:

        def ast_callback(main_ast, expr_ast):
            if self.spy:
                # Mush the two AST chunks into a single module for
                # conversion into Python.
                new_ast = ast.Module(main_ast.body + [ast.Expr(expr_ast.body)])
                print(astor.to_source(new_ast))

        value = hy_eval(do, self.locals, "__console__", ast_callback)
    except HyTypeError as e:
        if e.source is None:
            e.source = source
            e.filename = filename
        if SIMPLE_TRACEBACKS:
            print(e, file=sys.stderr)
        else:
            self.showtraceback()
        return False
    except Exception:
        self.showtraceback()
        return False

    if value is not None:
        # Make the last non-None value available to
        # the user as `_`.
        self.locals["_"] = value
        # Print the value.
        print(self.output_fn(value))
    return False


# Traceback (ZeroDivisionError)
=> (defclass BadRepr[] (defn __repr__ [self] (/ 0)))
class BadRepr:

def __repr__(self):
return (1 / 0)
None
=> (BadRepr)
BadRepr()
Traceback (most recent call last):
File "C:\Users\ME\workspace\hy36-gilch\Scripts\hy-script.py", line 11, in <module>
load_entry_point('hy', 'console_scripts', 'hy')()
File "c:\users\me\documents\github\hy\hy\cmdline.py", line 341, in hy_main
sys.exit(cmdline_handler("hy", sys.argv))
File "c:\users\me\documents\github\hy\hy\cmdline.py", line 336, in cmdline_handler
return run_repl(spy=options.spy, output_fn=options.repl_output_fn)
File "c:\users\me\documents\github\hy\hy\cmdline.py", line 231, in run_repl
os=platform.system()
File "C:\Users\ME\AppData\Local\Programs\Python\Python36\lib\code.py", line 233, in interact
more = self.push(line)
File "C:\Users\ME\AppData\Local\Programs\Python\Python36\lib\code.py", line 259, in push
more = self.runsource(source, self.filename)
File "c:\users\me\documents\github\hy\hy\cmdline.py", line 118, in runsource
print(self.output_fn(value))
File "<eval_body>", line 1, in __repr__
ZeroDivisionError: division by zero

(hy36-gilch) C:\Users\ME\Documents\GitHub\hy>

# Fixed code
def runsource(self, source, filename="<input>", symbol="single"):
    global SIMPLE_TRACEBACKS
    try:
        try:
            do = import_buffer_to_hst(source)
        except PrematureEndOfInput:
            return True
    except LexException as e:
        if e.source is None:
            e.source = source
            e.filename = filename
        print(e, file=sys.stderr)
        return False

    try:

        def ast_callback(main_ast, expr_ast):
            if self.spy:
                # Mush the two AST chunks into a single module for
                # conversion into Python.
                new_ast = ast.Module(main_ast.body + [ast.Expr(expr_ast.body)])
                print(astor.to_source(new_ast))

        value = hy_eval(do, self.locals, "__console__", ast_callback)
    except HyTypeError as e:
        if e.source is None:
            e.source = source
            e.filename = filename
        if SIMPLE_TRACEBACKS:
            print(e, file=sys.stderr)
        else:
            self.showtraceback()
        return False
    except Exception:
        self.showtraceback()
        return False

    if value is not None:
        # Make the last non-None value available to
        # the user as `_`.
        self.locals["_"] = value
        # Print the value.
        try:
            output = self.output_fn(value)
        except Exception:
            self.showtraceback()
            return False
        print(output)
    return False