| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
From offline conversation @pablogsal, this was waiting on trying to get a generic way to detect these kinds of cycles. It seemed to be much harder than initially thought. |
Sorry, something went wrong.
…nces 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
…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
The cycle happens when an exception is raised in `socket.create_connection` as it saves the exception in a variable and then re-raise it. By removing the name when the exception is raised we remove this cycle. We cannot just remove the name before as in the happy path since we need the exception to be raised.
As the exceptions were being saved in a different name it was generating a cycle since it was own through the `__traceback__`. By unsetting them we can collect the object earlier without the need of waiting for the gc.
As the exceptions were being saved in a different name it was generating a cycle since it was own through the `__traceback__`. By unsetting them we can collect the object earlier without the need of waiting for the gc.
There was a problem hiding this comment.
LGTM 🚀
Sorry, something went wrong.
|
@mariocj89: Status check is done, and it's a success ✅ . |
Sorry, something went wrong.
|
Thanks @mariocj89 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7. |
Sorry, something went wrong.
|
Thanks @mariocj89 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
Sorry, something went wrong.
|
GH-17485 is a backport of this pull request to the 3.7 branch. |
Sorry, something went wrong.
pythonGH-13135) Break cycle generated when saving an exception in socket.py, codeop.py and dyld.py as they keep alive not only the exception but user objects through the ``__traceback__`` attribute. https://bugs.python.org/issue36820 Automerge-Triggered-By: @pablogsal (cherry picked from commit b64334c) Co-authored-by: Mario Corchero <mcorcherojim@bloomberg.net>
|
GH-17486 is a backport of this pull request to the 3.8 branch. |
Sorry, something went wrong.
pythonGH-13135) Break cycle generated when saving an exception in socket.py, codeop.py and dyld.py as they keep alive not only the exception but user objects through the ``__traceback__`` attribute. https://bugs.python.org/issue36820 Automerge-Triggered-By: @pablogsal (cherry picked from commit b64334c) Co-authored-by: Mario Corchero <mcorcherojim@bloomberg.net>
GH-13135) Break cycle generated when saving an exception in socket.py, codeop.py and dyld.py as they keep alive not only the exception but user objects through the ``__traceback__`` attribute. https://bugs.python.org/issue36820 Automerge-Triggered-By: @pablogsal (cherry picked from commit b64334c) Co-authored-by: Mario Corchero <mcorcherojim@bloomberg.net>
GH-13135) Break cycle generated when saving an exception in socket.py, codeop.py and dyld.py as they keep alive not only the exception but user objects through the ``__traceback__`` attribute. https://bugs.python.org/issue36820 Automerge-Triggered-By: @pablogsal (cherry picked from commit b64334c) Co-authored-by: Mario Corchero <mcorcherojim@bloomberg.net>
…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
pythonGH-13135) Break cycle generated when saving an exception in socket.py, codeop.py and dyld.py as they keep alive not only the exception but user objects through the ``__traceback__`` attribute. https://bugs.python.org/issue36820 Automerge-Triggered-By: @pablogsal
| Back | FazBrowse Home | New Git URL |
Break cycle generated when saving an exception in socket.py, codeop.py and dyld.py as they keep alive not only the exception but user objects through the __traceback__ attribute.
https://bugs.python.org/issue36820
Automerge-Triggered-By: @pablogsal