From 3cfdd9c1d53bdcc95b3779caaa2ab5953b604797 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Thu, 4 Jun 2009 10:21:10 +0000 Subject: Merged revisions 73186,73206,73212 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r73186 | georg.brandl | 2009-06-03 23:21:09 +0200 (Mi, 03 Jun 2009) | 1 line #6174: fix indentation in code example. ........ r73206 | georg.brandl | 2009-06-04 11:15:12 +0200 (Do, 04 Jun 2009) | 1 line #3584: ignore trailing newlines when placing the caret for a SyntaxError location. ........ r73212 | georg.brandl | 2009-06-04 12:10:41 +0200 (Do, 04 Jun 2009) | 1 line Better name for "Ctor". ........ --- Doc/whatsnew/2.6.rst | 14 +++++++------- Lib/test/test_with.py | 4 ++-- Lib/traceback.py | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Doc/whatsnew/2.6.rst b/Doc/whatsnew/2.6.rst index df0b589..fc1525e 100644 --- a/Doc/whatsnew/2.6.rst +++ b/Doc/whatsnew/2.6.rst @@ -682,15 +682,15 @@ and :meth:`Semaphore` to create shared locks.) for N in range(1, 1000, 10): p.apply_async(factorial, (N, d)) - # Mark pool as closed -- no more tasks can be added. - p.close() + # Mark pool as closed -- no more tasks can be added. + p.close() - # Wait for tasks to exit - p.join() + # Wait for tasks to exit + p.join() - # Output results - for k, v in sorted(d.items()): - print k, v + # Output results + for k, v in sorted(d.items()): + print k, v This will produce the output:: diff --git a/Lib/test/test_with.py b/Lib/test/test_with.py index 105be8b..ae2fa4d 100644 --- a/Lib/test/test_with.py +++ b/Lib/test/test_with.py @@ -677,7 +677,7 @@ class NestedWith(unittest.TestCase): if self.gobble: return True - class CtorRaises(object): + class InitRaises(object): def __init__(self): raise RuntimeError() class EnterRaises(object): @@ -697,7 +697,7 @@ class NestedWith(unittest.TestCase): def testExceptionInExprList(self): try: - with self.Dummy() as a, self.CtorRaises(): + with self.Dummy() as a, self.InitRaises(): pass except: pass diff --git a/Lib/traceback.py b/Lib/traceback.py index 571ff57..5f92415 100644 --- a/Lib/traceback.py +++ b/Lib/traceback.py @@ -225,7 +225,7 @@ def format_exception_only(etype, value): if badline is not None: lines.append(' %s\n' % badline.strip()) if offset is not None: - caretspace = badline[:offset].lstrip() + caretspace = badline.rstrip('\n')[:offset].lstrip() # non-space whitespace (likes tabs) must be kept for alignment caretspace = ((c.isspace() and c or ' ') for c in caretspace) # only three spaces to account for offset1 == pos 0 -- cgit v0.12