diff options
| author | Pablo Galindo <Pablogsal@gmail.com> | 2019-11-19 21:34:03 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-19 21:34:03 +0000 |
| commit | 293dd23477eef6e7c1b1e26b5bb2c1e0d79ac3c2 (patch) | |
| tree | 295b4eee204f0d1e4723e62825a86310ddc27578 /Lib/test/test_sys_settrace.py | |
| parent | c6b20be85c0de6f2355c67ae6e7e578941275cc0 (diff) | |
| download | cpython-git-293dd23477eef6e7c1b1e26b5bb2c1e0d79ac3c2.tar.gz | |
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_sys_settrace.py')
| -rw-r--r-- | Lib/test/test_sys_settrace.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py index fdd789475d..d4e1ac2c83 100644 --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -161,8 +161,8 @@ def raises(): def test_raise(): try: raises() - except Exception as exc: - x = 1 + except Exception: + pass test_raise.events = [(0, 'call'), (1, 'line'), @@ -191,7 +191,7 @@ def _settrace_and_raise(tracefunc): def settrace_and_raise(tracefunc): try: _settrace_and_raise(tracefunc) - except RuntimeError as exc: + except RuntimeError: pass settrace_and_raise.events = [(2, 'exception'), |
