]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
reverting r45322 - "traceback.format_exception_only() now prepends
authorAnthony Baxter <anthonybaxter@gmail.com>
Thu, 13 Apr 2006 01:29:10 +0000 (01:29 +0000)
committerAnthony Baxter <anthonybaxter@gmail.com>
Thu, 13 Apr 2006 01:29:10 +0000 (01:29 +0000)
the exception's module name to non-builtin exceptions, like the
interpreter itself does."

Reverting because:
A - broke tests
B - changed behaviour of 2.4.

Lib/test/test_traceback.py
Lib/traceback.py
Misc/NEWS

index f3efc3c82c8e51ae6a565032590ecc7e4a7c16f6..17ed022617b25b4fb3a8fe5c0345baaf32231310 100644 (file)
@@ -5,9 +5,6 @@ from test.test_support import run_unittest, is_jython
 
 import traceback
 
-class TbError(Exception):
-    pass
-
 class TracebackCases(unittest.TestCase):
     # For now, a very minimal set of tests.  I want to be sure that
     # formatting of SyntaxErrors works based on changes for 2.1.
@@ -88,24 +85,6 @@ def test():
                 os.unlink(os.path.join(testdir, f))
             os.rmdir(testdir)
 
-    def raise_tberror(self):
-        raise TbError
-
-    def raise_typeerror(self):
-        raise TypeError
-
-    def test_modulename(self):
-        # Bug 860326: format_exception_only should prepend module name
-        # to exceptions not in "exceptions", like PyErr_Print does.
-        err = self.get_exception_format(self.raise_tberror, TbError)
-        self.assertEquals(len(err), 1)
-        self.assert_(err[0] == '__main__.TbError\n' or
-                     err[0] == 'test.test_traceback.TbError\n')
-
-        err = self.get_exception_format(self.raise_typeerror, TypeError)
-        self.assertEquals(err[0], 'TypeError\n')
-
-
 def test_main():
     run_unittest(TracebackCases)
 
index fbdfb6a4928598dcca7314e35cf9509a530b0180..95cde2bd75ca792c6a54bda38c64cfcfe0dd1262 100644 (file)
@@ -159,10 +159,6 @@ def format_exception_only(etype, value):
     list = []
     if type(etype) == types.ClassType:
         stype = etype.__name__
-        if not hasattr(etype, '__module__'):
-            stype = '<unknown>.' + stype
-        elif etype.__module__ != 'exceptions':
-            stype = etype.__module__ + '.' + stype
     else:
         stype = etype
     if value is None:
index 9d705ffb505139f17f3a305f4e9e01bcb1314737..e1cf2ef52cea78bc7a270f3fad666963c10a0af4 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -23,10 +23,6 @@ Extension Modules
 Library
 -------
 
-- Patch #860326: traceback.format_exception_only() now prepends the
-  exception's module name to non-builtin exceptions, like the interpreter
-  itself does.
-
 - The email module's parsedate_tz function now sets the daylight savings
   flag to -1 (unknown) since it can't tell from the date whether it should
   be set.