diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2019-11-19 21:34:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-19 21:34:03 (GMT) |
commit | 293dd23477eef6e7c1b1e26b5bb2c1e0d79ac3c2 (patch) | |
tree | 295b4eee204f0d1e4723e62825a86310ddc27578 /Lib/test/test_traceback.py | |
parent | c6b20be85c0de6f2355c67ae6e7e578941275cc0 (diff) | |
download | cpython-293dd23477eef6e7c1b1e26b5bb2c1e0d79ac3c2.zip cpython-293dd23477eef6e7c1b1e26b5bb2c1e0d79ac3c2.tar.gz cpython-293dd23477eef6e7c1b1e26b5bb2c1e0d79ac3c2.tar.bz2 |
Remove binding of captured exceptions when not used to reduce the chances of creating cycles (GH-17246)
Capturing exceptions into names can lead to reference cycles though the __traceback__ attribute of the exceptions in some obscure cases that have been reported previously and fixed individually. As these variables are not used anyway, we can remove the binding to reduce the chances of creating reference cycles.
See for example GH-13135
Diffstat (limited to 'Lib/test/test_traceback.py')
-rw-r--r-- | Lib/test/test_traceback.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 72dc7af..7135d99 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -313,7 +313,7 @@ class TracebackFormatTests(unittest.TestCase): with captured_output("stderr") as stderr_f: try: f() - except RecursionError as exc: + except RecursionError: render_exc() else: self.fail("no recursion occurred") @@ -360,7 +360,7 @@ class TracebackFormatTests(unittest.TestCase): with captured_output("stderr") as stderr_g: try: g() - except ValueError as exc: + except ValueError: render_exc() else: self.fail("no value error was raised") @@ -396,7 +396,7 @@ class TracebackFormatTests(unittest.TestCase): with captured_output("stderr") as stderr_h: try: h() - except ValueError as exc: + except ValueError: render_exc() else: self.fail("no value error was raised") @@ -424,7 +424,7 @@ class TracebackFormatTests(unittest.TestCase): with captured_output("stderr") as stderr_g: try: g(traceback._RECURSIVE_CUTOFF) - except ValueError as exc: + except ValueError: render_exc() else: self.fail("no error raised") @@ -452,7 +452,7 @@ class TracebackFormatTests(unittest.TestCase): with captured_output("stderr") as stderr_g: try: g(traceback._RECURSIVE_CUTOFF + 1) - except ValueError as exc: + except ValueError: render_exc() else: self.fail("no error raised") |