Remove binding of captured exceptions when not used to reduce the chances of creating cycles by pablogsal · Pull Request #17246 · python/cpython

@pablogsal

brettcannon

gvanrossum

jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request

Dec 5, 2019
…nces of creating cycles (pythonGH-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 pythonGH-13135

shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request

Jan 31, 2020
…nces of creating cycles (pythonGH-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 pythonGH-13135