diff options
| author | Antoine Pitrou <solipsis@pitrou.net> | 2014-04-28 23:23:50 (GMT) |
|---|---|---|
| committer | Antoine Pitrou <solipsis@pitrou.net> | 2014-04-28 23:23:50 (GMT) |
| commit | 9681022f1ee5c6c9160c515b24d2a3d1efe8b90d (patch) | |
| tree | c1d1cfd55d9b22733b4655b31324a3c33d136de8 /Lib/unittest/case.py | |
| parent | 871dfc41d37b02a7af6eb03028edc6702f24fd1d (diff) | |
| download | cpython-9681022f1ee5c6c9160c515b24d2a3d1efe8b90d.zip cpython-9681022f1ee5c6c9160c515b24d2a3d1efe8b90d.tar.gz cpython-9681022f1ee5c6c9160c515b24d2a3d1efe8b90d.tar.bz2 | |
Issue #9815: assertRaises now tries to clear references to local variables in the exception's traceback.
Diffstat (limited to 'Lib/unittest/case.py')
| -rw-r--r-- | Lib/unittest/case.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py index bedbc67..aa00b7a 100644 --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -9,6 +9,7 @@ import re import warnings import collections import contextlib +import traceback from . import result from .util import (strclass, safe_repr, _count_diff_all_purpose, @@ -178,6 +179,8 @@ class _AssertRaisesContext(_AssertRaisesBaseContext): self.obj_name)) else: self._raiseFailure("{} not raised".format(exc_name)) + else: + traceback.clear_frames(tb) if not issubclass(exc_type, self.expected): # let unexpected exceptions pass through return False |
