[Python-checkins] r45327 - in python/trunk: Lib/test/test_traceback.py Lib/traceback.py Misc/NEWS

anthony.baxter python-checkins at python.org
Thu Apr 13 03:34:35 CEST 2006


Author: anthony.baxter
Date: Thu Apr 13 03:34:33 2006
New Revision: 45327

Modified:
   python/trunk/Lib/test/test_traceback.py
   python/trunk/Lib/traceback.py
   python/trunk/Misc/NEWS
Log:
reverting r45321: Patch #860326: traceback.format_exception_only() now 
prepends the exception's module name to non-builtin exceptions, like 
the interpreter itself does.

broke a number of doctests. should be discussed before checking in (see
discussion on python-dev).


Modified: python/trunk/Lib/test/test_traceback.py
==============================================================================
--- python/trunk/Lib/test/test_traceback.py	(original)
+++ python/trunk/Lib/test/test_traceback.py	Thu Apr 13 03:34:33 2006
@@ -5,9 +5,6 @@
 
 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.
@@ -106,24 +103,6 @@
             import sys
             sys.exc_traceback.__members__
 
-    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)
 

Modified: python/trunk/Lib/traceback.py
==============================================================================
--- python/trunk/Lib/traceback.py	(original)
+++ python/trunk/Lib/traceback.py	Thu Apr 13 03:34:33 2006
@@ -158,12 +158,8 @@
     """
     list = []
     if (type(etype) == types.ClassType
-        or (isinstance(etype, type) and issubclass(etype, BaseException))):
+        or (isinstance(etype, type) and issubclass(etype, Exception))):
         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:

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Thu Apr 13 03:34:33 2006
@@ -49,10 +49,6 @@
 Library
 -------
 
-- Patch #860326: traceback.format_exception_only() now prepends the
-  exception's module name to non-builtin exceptions, like the interpreter
-  itself does.
-
 - SimpleXMLRPCServer relied on the fcntl module, which is unavailable on
   Windows. Bug #1469163.
 


More information about the Python-checkins mailing list