]> granicus.if.org Git - python/commitdiff
When printing an unraisable error, don't print exceptions. before the name.
authorNeal Norwitz <nnorwitz@gmail.com>
Mon, 26 Feb 2007 22:41:45 +0000 (22:41 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Mon, 26 Feb 2007 22:41:45 +0000 (22:41 +0000)
This duplicates the behavior whening normally printing exceptions.

Lib/test/test_generators.py
Misc/NEWS
Python/errors.c

index ee36413de7ccd4f733f1bf9c7959c049b186605e..2b0d47d1b63cdaf114ce02af0e9bc71ed44ebec3 100644 (file)
@@ -1681,7 +1681,7 @@ Our ill-behaved code should be invoked during GC:
 >>> g.next()
 >>> del g
 >>> sys.stderr.getvalue().startswith(
-...     "Exception exceptions.RuntimeError: 'generator ignored GeneratorExit' in "
+...     "Exception RuntimeError: 'generator ignored GeneratorExit' in "
 ... )
 True
 >>> sys.stderr = old
@@ -1798,7 +1798,7 @@ to test.
 ...     del l
 ...     err = sys.stderr.getvalue().strip()
 ...     err.startswith(
-...         "Exception exceptions.RuntimeError: RuntimeError() in <"
+...         "Exception RuntimeError: RuntimeError() in <"
 ...     )
 ...     err.endswith("> ignored")
 ...     len(err.splitlines())
index 4428670b40cda3388bc7439753d61b901dbff1d4..c60cf39753f6cc627d14d32952b41d633ef3e3f7 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 1?
 Core and builtins
 -----------------
 
+- When printing an unraisable error, don't print exceptions. before the name.
+  This duplicates the behavior whening normally printing exceptions.
+
 - Bug #1653736: Properly discard third argument to slot_nb_inplace_power.
 
 - PEP 352: Raising a string exception now triggers a TypeError.  Attempting to
index f31f025112e72e58996ce6bdff8692106d0156cb..9a23c05282834b0f2b6aff5f263ab0f1aa794004 100644 (file)
@@ -603,7 +603,8 @@ PyErr_WriteUnraisable(PyObject *obj)
                                PyFile_WriteString("<unknown>", f);
                        else {
                                char* modstr = PyString_AsString(moduleName);
-                               if (modstr)
+                               if (modstr &&
+                                   strcmp(modstr, "exceptions") != 0)
                                {
                                        PyFile_WriteString(modstr, f);
                                        PyFile_WriteString(".", f);