[Python-checkins] r53969 - in python/trunk: Lib/test/test_generators.py Misc/NEWS Python/errors.c

neal.norwitz python-checkins at python.org
Mon Feb 26 23:41:54 CET 2007


Author: neal.norwitz
Date: Mon Feb 26 23:41:45 2007
New Revision: 53969

Modified:
   python/trunk/Lib/test/test_generators.py
   python/trunk/Misc/NEWS
   python/trunk/Python/errors.c
Log:
When printing an unraisable error, don't print exceptions. before the name.
This duplicates the behavior whening normally printing exceptions.


Modified: python/trunk/Lib/test/test_generators.py
==============================================================================
--- python/trunk/Lib/test/test_generators.py	(original)
+++ python/trunk/Lib/test/test_generators.py	Mon Feb 26 23:41:45 2007
@@ -1681,7 +1681,7 @@
 >>> 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 @@
 ...     del l
 ...     err = sys.stderr.getvalue().strip()
 ...     err.startswith(
-...         "Exception exceptions.RuntimeError: RuntimeError() in <"
+...         "Exception RuntimeError: RuntimeError() in <"
 ...     )
 ...     err.endswith("> ignored")
 ...     len(err.splitlines())

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Mon Feb 26 23:41:45 2007
@@ -12,6 +12,9 @@
 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

Modified: python/trunk/Python/errors.c
==============================================================================
--- python/trunk/Python/errors.c	(original)
+++ python/trunk/Python/errors.c	Mon Feb 26 23:41:45 2007
@@ -603,7 +603,8 @@
 				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);


More information about the Python-checkins mailing list