)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"02d827f61192ddc6854a7920b11029559771f37e","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":1,"id":"1e1f5738_fffbf437","updated":"2023-09-08 04:01:21.000000000","message":"recheck\n\nhttps://bugs.launchpad.net/swift/+bug/2028175","commit_id":"882880f5e680d5c16f1b679ec3202357a1ebc0ca"}],"swift/common/utils/__init__.py":[{"author":{"_account_id":597,"name":"Pete Zaitcev","email":"zaitcev@kotori.zaitcev.us","username":"zaitcev"},"change_message_id":"6e307f2142ec7bbb1932fa6f0754faac670404a2","unresolved":true,"context_lines":[{"line_number":6332,"context_line":"            self._run_gth \u003d eventlet.spawn(self.run)"},{"line_number":6333,"context_line":""},{"line_number":6334,"context_line":"    def __del__(self):"},{"line_number":6335,"context_line":"        gth \u003d getattr(self, \u0027_run_gth\u0027, None)"},{"line_number":6336,"context_line":"        if gth:"},{"line_number":6337,"context_line":"            gth.kill()"},{"line_number":6338,"context_line":"        self._run_gth \u003d None"}],"source_content_type":"text/x-python","patch_set":1,"id":"626494e5_399731bb","line":6335,"updated":"2023-09-08 03:22:37.000000000","message":"Why getattr? You think Even() can throw and then half-inited instance gets invoked with __del__()?","commit_id":"882880f5e680d5c16f1b679ec3202357a1ebc0ca"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"02d827f61192ddc6854a7920b11029559771f37e","unresolved":true,"context_lines":[{"line_number":6332,"context_line":"            self._run_gth \u003d eventlet.spawn(self.run)"},{"line_number":6333,"context_line":""},{"line_number":6334,"context_line":"    def __del__(self):"},{"line_number":6335,"context_line":"        gth \u003d getattr(self, \u0027_run_gth\u0027, None)"},{"line_number":6336,"context_line":"        if gth:"},{"line_number":6337,"context_line":"            gth.kill()"},{"line_number":6338,"context_line":"        self._run_gth \u003d None"}],"source_content_type":"text/x-python","patch_set":1,"id":"aa73f00b_4c107858","line":6335,"in_reply_to":"626494e5_399731bb","updated":"2023-09-08 04:01:21.000000000","message":"Yeah, if anything goes wrong in `__init__` (maybe something going sideways in `Event()`, maybe even just some out-of-memory error because of the `dict()`), `__del__` can get called with whatever was there before the exception:\n```\n\u003e\u003e\u003e class A:\n...     def __init__(self):\n...             print(\u0027in __init__\u0027)\n...             raise Exception\n...             self.x \u003d \u0027y\u0027\n...     def __del__(self):\n...             print(\u0027in __del__\u0027)\n...             print(f\u0027{hasattr(self, \"x\")\u003d}\u0027)\n... \n\u003e\u003e\u003e a\u003dA()\nin __init__\nTraceback (most recent call last):\n  File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\n  File \"\u003cstdin\u003e\", line 4, in __init__\nException\n\u003e\u003e\u003e a\nin __del__\nhasattr(self, \"x\")\u003dFalse\nTraceback (most recent call last):\n  File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\nNameError: name \u0027a\u0027 is not defined. Did you mean: \u0027A\u0027?\n```\nI feel like I\u0027ve also bumped into circumstances where my `__del__` would raise some weird `AttributeError` or `NameError` (though maybe it\u0027s just my memory playing tricks on me, and what I *actually* saw was some global getting set to `None` or something) -- at any rate, I\u0027ve learned to be incredibly defensive in a `__del__`, even if it may not be fully warranted.\n\nOr better still, avoid them entirely -- but I really haven\u0027t found any better way to get this background-thread cleanup I want. The explicit kills in the parent patch are definitely an improvement, but there are *so many* places in tests that we create an `Application` **not** via `run_server` and without really thinking about how we\u0027ve spawned a greenthread as a result.","commit_id":"882880f5e680d5c16f1b679ec3202357a1ebc0ca"}]}
