cpython: a812de69b493 (original) (raw)

Mercurial > cpython

changeset 78672:a812de69b493

Issue #12643: Respect sys.excepthook in code.InteractiveConsole [#12643]

Nick Coghlan ncoghlan@gmail.com
date Mon, 20 Aug 2012 23:02:28 +1000
parents 5b1b9cfb7fe8
children 663de4dbb88a
files Lib/code.py Lib/test/test_code_module.py Lib/test/test_sundry.py Misc/ACKS Misc/NEWS
diffstat 5 files changed, 91 insertions(+), 5 deletions(-)[+] [-] Lib/code.py 19 Lib/test/test_code_module.py 72 Lib/test/test_sundry.py 1 Misc/ACKS 1 Misc/NEWS 3

line wrap: on

line diff

--- a/Lib/code.py +++ b/Lib/code.py @@ -105,9 +105,10 @@ class InteractiveInterpreter: The output is written by self.write(), below. """

@@ -119,8 +120,13 @@ class InteractiveInterpreter: # Stuff in the right filename value = SyntaxError(msg, (filename, lineno, offset, line)) sys.last_value = value

def showtraceback(self): """Display the exception that just occurred. @@ -143,7 +149,12 @@ class InteractiveInterpreter: lines.extend(traceback.format_exception_only(type, value)) finally: tblist = tb = None

def write(self, data): """Write a string.

new file mode 100644 --- /dev/null +++ b/Lib/test/test_code_module.py @@ -0,0 +1,72 @@ +"Test InteractiveConsole and InteractiveInterpreter from code module" +import sys +import unittest +from contextlib import ExitStack +from unittest import mock +from test import support + +code = support.import_module('code') + + +class TestInteractiveConsole(unittest.TestCase): +

+

+

+

+

+

+

+ + +def test_main():

+ +if name == "main":

--- a/Lib/test/test_sundry.py +++ b/Lib/test/test_sundry.py @@ -9,7 +9,6 @@ class TestUntestedModules(unittest.TestC with support.check_warnings(quiet=True): import bdb import cgitb

import distutils.bcppcompiler import distutils.ccompiler

--- a/Misc/ACKS +++ b/Misc/ACKS @@ -487,6 +487,7 @@ Fredrik Håård Catalin Iacob Mihai Ibanescu Ali Ikinci +Aaron Iles Lars Immisch Bobby Impollonia Meador Inge

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -19,6 +19,9 @@ Core and Builtins Library ------- +- Issue #12643: code.InteractiveConsole now respects sys.excepthook when