)]}'
{"/PATCHSET_LEVEL":[{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"7e1f7f498c9a1104f9f16092caff81f8740d5080","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"58a12f88_73c375eb","updated":"2024-01-24 19:33:51.000000000","message":"I think I\u0027ll go ahead and squash this into the parent.","commit_id":"154c3e1e1cc0e9f765fca55cd8726d5130a39784"}],"swift/common/utils/__init__.py":[{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"4a3c158e19aaa609f3b6f93efc53930d77f840b7","unresolved":true,"context_lines":[{"line_number":4396,"context_line":"    yield terminator"},{"line_number":4397,"context_line":""},{"line_number":4398,"context_line":""},{"line_number":4399,"context_line":"class ClosingIterator(object):"},{"line_number":4400,"context_line":"    \"\"\""},{"line_number":4401,"context_line":"    Wrap another iterator and close it when this one is closed."},{"line_number":4402,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"cd3dcd4f_ea787250","line":4399,"updated":"2024-01-08 17:40:13.000000000","message":"this can be subclassed by CooperativeIterator","commit_id":"4139b81ace834cb64291e4d1a2de4850cc22e677"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"53d5d9b4d043ed9b4840416aec0d88a35b348614","unresolved":false,"context_lines":[{"line_number":4396,"context_line":"    yield terminator"},{"line_number":4397,"context_line":""},{"line_number":4398,"context_line":""},{"line_number":4399,"context_line":"class ClosingIterator(object):"},{"line_number":4400,"context_line":"    \"\"\""},{"line_number":4401,"context_line":"    Wrap another iterator and close it when this one is closed."},{"line_number":4402,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"be557b8b_3c23456b","line":4399,"in_reply_to":"cd3dcd4f_ea787250","updated":"2024-01-11 20:54:52.000000000","message":"Done","commit_id":"4139b81ace834cb64291e4d1a2de4850cc22e677"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"dac06c96b1a3160d30b4e55354717a73d57c2ac7","unresolved":true,"context_lines":[{"line_number":4407,"context_line":"        # this is the object to close"},{"line_number":4408,"context_line":"        self.wrapped \u003d [iterable]"},{"line_number":4409,"context_line":"        if other_iterables:"},{"line_number":4410,"context_line":"            self.wrapped.extend(other_iterables)"},{"line_number":4411,"context_line":"        # this is usually, but not necessarily, the same object"},{"line_number":4412,"context_line":"        self.wrapped_iter \u003d iter(iterable)"},{"line_number":4413,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"95121731_65cea4ba","line":4410,"updated":"2024-01-10 21:01:57.000000000","message":"It took me a bit to realize that this is where the real power comes in. `other_iterables` should definitely be documented, and we should probably highlight the `ClosingIterator(generator, resource_used_by_generator)` use-case and what the pitfall is if you don\u0027t use this (ie, you may close the generator before it\u0027s started, and never hit any `finally:` code inside the generator).","commit_id":"4139b81ace834cb64291e4d1a2de4850cc22e677"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"dac06c96b1a3160d30b4e55354717a73d57c2ac7","unresolved":true,"context_lines":[{"line_number":4415,"context_line":"        return self"},{"line_number":4416,"context_line":""},{"line_number":4417,"context_line":"    def __next__(self):"},{"line_number":4418,"context_line":"        return next(self.wrapped_iter)"},{"line_number":4419,"context_line":""},{"line_number":4420,"context_line":"    def next(self):"},{"line_number":4421,"context_line":"        return self.__next__()"}],"source_content_type":"text/x-python","patch_set":1,"id":"c951fb0b_6710166a","line":4418,"updated":"2024-01-10 21:01:57.000000000","message":"Better as\n```\ndef __next__(self):\n    try:\n        return next(self.wrapped_iter)\n    except StopIteration:\n        self.close()\n        raise\n```\n?","commit_id":"4139b81ace834cb64291e4d1a2de4850cc22e677"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"fa9a08671d31a66d7dbfbfd4ffa621436f7dec00","unresolved":false,"context_lines":[{"line_number":4415,"context_line":"        return self"},{"line_number":4416,"context_line":""},{"line_number":4417,"context_line":"    def __next__(self):"},{"line_number":4418,"context_line":"        return next(self.wrapped_iter)"},{"line_number":4419,"context_line":""},{"line_number":4420,"context_line":"    def next(self):"},{"line_number":4421,"context_line":"        return self.__next__()"}],"source_content_type":"text/x-python","patch_set":1,"id":"71ac1ad3_c88c2882","line":4418,"in_reply_to":"c951fb0b_6710166a","updated":"2024-01-12 14:32:51.000000000","message":"Done","commit_id":"4139b81ace834cb64291e4d1a2de4850cc22e677"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"dac06c96b1a3160d30b4e55354717a73d57c2ac7","unresolved":true,"context_lines":[{"line_number":4442,"context_line":"                raise"},{"line_number":4443,"context_line":"            else:"},{"line_number":4444,"context_line":"                self.logger.warning("},{"line_number":4445,"context_line":"                    \"More than one part in a single-part response?\")"},{"line_number":4446,"context_line":""},{"line_number":4447,"context_line":""},{"line_number":4448,"context_line":"def document_iters_to_http_response_body(ranges_iter, boundary, multipart,"}],"source_content_type":"text/x-python","patch_set":1,"id":"192bdf54_c0eeaf84","line":4445,"updated":"2024-01-10 21:01:57.000000000","message":"Seems like this should have a `self.close()`, too.","commit_id":"4139b81ace834cb64291e4d1a2de4850cc22e677"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"67854287a4e45bedfc7d7eee0a87a03bfc144943","unresolved":true,"context_lines":[{"line_number":4442,"context_line":"                raise"},{"line_number":4443,"context_line":"            else:"},{"line_number":4444,"context_line":"                self.logger.warning("},{"line_number":4445,"context_line":"                    \"More than one part in a single-part response?\")"},{"line_number":4446,"context_line":""},{"line_number":4447,"context_line":""},{"line_number":4448,"context_line":"def document_iters_to_http_response_body(ranges_iter, boundary, multipart,"}],"source_content_type":"text/x-python","patch_set":1,"id":"89a8c188_59a9fbc9","line":4445,"in_reply_to":"192bdf54_c0eeaf84","updated":"2024-01-11 19:23:39.000000000","message":"I think it should raise?","commit_id":"4139b81ace834cb64291e4d1a2de4850cc22e677"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"53d5d9b4d043ed9b4840416aec0d88a35b348614","unresolved":false,"context_lines":[{"line_number":4442,"context_line":"                raise"},{"line_number":4443,"context_line":"            else:"},{"line_number":4444,"context_line":"                self.logger.warning("},{"line_number":4445,"context_line":"                    \"More than one part in a single-part response?\")"},{"line_number":4446,"context_line":""},{"line_number":4447,"context_line":""},{"line_number":4448,"context_line":"def document_iters_to_http_response_body(ranges_iter, boundary, multipart,"}],"source_content_type":"text/x-python","patch_set":1,"id":"940ee734_b62a7f2c","line":4445,"in_reply_to":"89a8c188_59a9fbc9","updated":"2024-01-11 20:54:52.000000000","message":"Done","commit_id":"4139b81ace834cb64291e4d1a2de4850cc22e677"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"53d5d9b4d043ed9b4840416aec0d88a35b348614","unresolved":true,"context_lines":[{"line_number":3698,"context_line":"    ``_get_next_item``."},{"line_number":3699,"context_line":""},{"line_number":3700,"context_line":"    :param iterable: iterator to wrap."},{"line_number":3701,"context_line":"    :param other_iters_to_close: other iterators to attempt to close."},{"line_number":3702,"context_line":"    :param close_on_exit: if True the"},{"line_number":3703,"context_line":"    \"\"\""},{"line_number":3704,"context_line":"    __slots__ \u003d (\u0027iters_to_close\u0027, \u0027wrapped_iter\u0027, \u0027close_on_exit\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"00410d69_b3bd8bc5","line":3701,"range":{"start_line":3701,"start_character":11,"end_line":3701,"end_character":31},"updated":"2024-01-11 20:54:52.000000000","message":"Might be worth noting that these don\u0027t actually _have_ to be iterators -- they can be arbitrary closable resources! I could totally see something like\n```python\ndef app_iter():\n    try:\n        while True:\n            yield sock.recv(1 \u003c\u003c 16)\n    except socket.error:\n        pass  # closed gracefully, hopefully?\n        \nreturn ClosingIterator(app_iter, sock)\n```\nbeing idiomatic (at least, with regard to `ClosingIterator`).","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"fa9a08671d31a66d7dbfbfd4ffa621436f7dec00","unresolved":true,"context_lines":[{"line_number":3698,"context_line":"    ``_get_next_item``."},{"line_number":3699,"context_line":""},{"line_number":3700,"context_line":"    :param iterable: iterator to wrap."},{"line_number":3701,"context_line":"    :param other_iters_to_close: other iterators to attempt to close."},{"line_number":3702,"context_line":"    :param close_on_exit: if True the"},{"line_number":3703,"context_line":"    \"\"\""},{"line_number":3704,"context_line":"    __slots__ \u003d (\u0027iters_to_close\u0027, \u0027wrapped_iter\u0027, \u0027close_on_exit\u0027)"}],"source_content_type":"text/x-python","patch_set":2,"id":"4c6deb57_14576270","line":3701,"range":{"start_line":3701,"start_character":11,"end_line":3701,"end_character":31},"in_reply_to":"00410d69_b3bd8bc5","updated":"2024-01-12 14:32:51.000000000","message":"absolutely, will change var name and docstring","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"67854287a4e45bedfc7d7eee0a87a03bfc144943","unresolved":true,"context_lines":[{"line_number":3704,"context_line":"    __slots__ \u003d (\u0027iters_to_close\u0027, \u0027wrapped_iter\u0027, \u0027close_on_exit\u0027)"},{"line_number":3705,"context_line":""},{"line_number":3706,"context_line":"    def __init__(self, iterable, other_iters_to_close\u003dNone,"},{"line_number":3707,"context_line":"                 close_on_exit\u003dFalse):"},{"line_number":3708,"context_line":"        self.iters_to_close \u003d [iterable]"},{"line_number":3709,"context_line":"        if other_iters_to_close:"},{"line_number":3710,"context_line":"            self.iters_to_close.extend(other_iters_to_close)"}],"source_content_type":"text/x-python","patch_set":2,"id":"d5105a47_02f7a3fc","line":3707,"range":{"start_line":3707,"start_character":17,"end_line":3707,"end_character":36},"updated":"2024-01-11 19:23:39.000000000","message":"I can\u0027t quite convincemyself that this should just be the default behavior. Certainly the other sublcasses (CloseableChain, CooperativeIterator) do not behave that way.\n\nclose_on_exit is intended to save writing something like:\n\n```\nit \u003d iter(ClosingIterator(wrapped))\nwith closing_if_possible(it):\n    for thing in it:\n        yield thing\n\n\n```","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"fa9a08671d31a66d7dbfbfd4ffa621436f7dec00","unresolved":true,"context_lines":[{"line_number":3704,"context_line":"    __slots__ \u003d (\u0027iters_to_close\u0027, \u0027wrapped_iter\u0027, \u0027close_on_exit\u0027)"},{"line_number":3705,"context_line":""},{"line_number":3706,"context_line":"    def __init__(self, iterable, other_iters_to_close\u003dNone,"},{"line_number":3707,"context_line":"                 close_on_exit\u003dFalse):"},{"line_number":3708,"context_line":"        self.iters_to_close \u003d [iterable]"},{"line_number":3709,"context_line":"        if other_iters_to_close:"},{"line_number":3710,"context_line":"            self.iters_to_close.extend(other_iters_to_close)"}],"source_content_type":"text/x-python","patch_set":2,"id":"e5707fce_f685c2c1","line":3707,"range":{"start_line":3707,"start_character":17,"end_line":3707,"end_character":36},"in_reply_to":"544a8b83_a52898d8","updated":"2024-01-12 14:32:51.000000000","message":"yeah, I\u0027d like to explore flipping the default since in general we want to be closing things\n\nfor the record, an alternative would be to add a method:\n\n```\ndef self_closing_iter(self):\n    with closing_if_possible(self):\n        for thing in self:\n            yield thing\n```","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"53d5d9b4d043ed9b4840416aec0d88a35b348614","unresolved":true,"context_lines":[{"line_number":3704,"context_line":"    __slots__ \u003d (\u0027iters_to_close\u0027, \u0027wrapped_iter\u0027, \u0027close_on_exit\u0027)"},{"line_number":3705,"context_line":""},{"line_number":3706,"context_line":"    def __init__(self, iterable, other_iters_to_close\u003dNone,"},{"line_number":3707,"context_line":"                 close_on_exit\u003dFalse):"},{"line_number":3708,"context_line":"        self.iters_to_close \u003d [iterable]"},{"line_number":3709,"context_line":"        if other_iters_to_close:"},{"line_number":3710,"context_line":"            self.iters_to_close.extend(other_iters_to_close)"}],"source_content_type":"text/x-python","patch_set":2,"id":"544a8b83_a52898d8","line":3707,"range":{"start_line":3707,"start_character":17,"end_line":3707,"end_character":36},"in_reply_to":"d5105a47_02f7a3fc","updated":"2024-01-11 20:54:52.000000000","message":"\u003e Certainly the other sublcasses (CloseableChain, CooperativeIterator) do not behave that way.\n\n_Yet._ Do their callers actually do the `with closing(...)`, though? Or are there still more opportunities for us to punt to garbage collection to close things down?\n\nThe need to wrap the `for` in a `with` is unfortunate, and I see the desire to skip it as entirely reasonable. Does anything actually _break_ if we flip this default?\n\n🤤 Oh, and once we drop py2...\n```\nyield from ClosingIterator(wrapped)\n```\n(Possibly with the extra `close_on_exit\u003dTrue`)","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"67854287a4e45bedfc7d7eee0a87a03bfc144943","unresolved":true,"context_lines":[{"line_number":3722,"context_line":"        try:"},{"line_number":3723,"context_line":"            return self._get_next_item()"},{"line_number":3724,"context_line":"        except StopIteration:"},{"line_number":3725,"context_line":"            if self.close_on_exit:"},{"line_number":3726,"context_line":"                self.close()"},{"line_number":3727,"context_line":"            raise"},{"line_number":3728,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"2bb6f56e_8a6e9b96","line":3725,"updated":"2024-01-11 19:23:39.000000000","message":"hmmm, maybe this should also happen in an ``except Exception`` clause","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"05e5016c3949217a8a0ba4fe8c5896c448c9efb6","unresolved":true,"context_lines":[{"line_number":3722,"context_line":"        try:"},{"line_number":3723,"context_line":"            return self._get_next_item()"},{"line_number":3724,"context_line":"        except StopIteration:"},{"line_number":3725,"context_line":"            if self.close_on_exit:"},{"line_number":3726,"context_line":"                self.close()"},{"line_number":3727,"context_line":"            raise"},{"line_number":3728,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"58ae83de_fe5e3481","line":3725,"in_reply_to":"1a633ca3_a53b6738","updated":"2024-01-13 06:17:47.000000000","message":"\u003e Turns out that if wrapped_iter is a generator then it\u0027s already terminated once it raises an exception, even if the consumer handles the exception.\n\nOh, I guess that makes sense, even given the model of generators-as-co-routines...\n\n\u003e the question is would a caller ever want to call `next` again, or execute other code before closing? Is that unusual enough that it\u0027s reasonable to expect the caller to use `close_on_exit \u003d False`?\n\nI\u0027d argue the answers are \"probably not\" and \"yes\".","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"53d5d9b4d043ed9b4840416aec0d88a35b348614","unresolved":true,"context_lines":[{"line_number":3722,"context_line":"        try:"},{"line_number":3723,"context_line":"            return self._get_next_item()"},{"line_number":3724,"context_line":"        except StopIteration:"},{"line_number":3725,"context_line":"            if self.close_on_exit:"},{"line_number":3726,"context_line":"                self.close()"},{"line_number":3727,"context_line":"            raise"},{"line_number":3728,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"cdbe9814_5355837d","line":3725,"in_reply_to":"2bb6f56e_8a6e9b96","updated":"2024-01-11 20:54:52.000000000","message":"Good thought -- yeah, I suppose if `next(it)` raised an exception, I\u0027d probably just throw `it` away; I can\u0027t think of _any_ reason I\u0027d ever want to call `next(it)` again...","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"7e1f7f498c9a1104f9f16092caff81f8740d5080","unresolved":true,"context_lines":[{"line_number":3722,"context_line":"        try:"},{"line_number":3723,"context_line":"            return self._get_next_item()"},{"line_number":3724,"context_line":"        except StopIteration:"},{"line_number":3725,"context_line":"            if self.close_on_exit:"},{"line_number":3726,"context_line":"                self.close()"},{"line_number":3727,"context_line":"            raise"},{"line_number":3728,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"222d3eaf_5983efc8","line":3725,"in_reply_to":"58ae83de_fe5e3481","updated":"2024-01-24 19:33:51.000000000","message":"FWIW, the only failures I see when I change the default are in `TestClosingIterator` or one case while testing internal_client where we do a double-close (but it seems like the `LeakTrackingIter` could become edge-triggered).","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"fa9a08671d31a66d7dbfbfd4ffa621436f7dec00","unresolved":true,"context_lines":[{"line_number":3722,"context_line":"        try:"},{"line_number":3723,"context_line":"            return self._get_next_item()"},{"line_number":3724,"context_line":"        except StopIteration:"},{"line_number":3725,"context_line":"            if self.close_on_exit:"},{"line_number":3726,"context_line":"                self.close()"},{"line_number":3727,"context_line":"            raise"},{"line_number":3728,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"1a633ca3_a53b6738","line":3725,"in_reply_to":"cdbe9814_5355837d","updated":"2024-01-12 14:32:51.000000000","message":"Turns out that if wrapped_iter is a generator then it\u0027s already terminated once it raises an exception, even if the consumer handles the exception.\n\nBut if it\u0027s an iterable class, like a ``ClosingIter`` :), then the question is would a caller ever want to call `next` again, or execute other code before closing? Is that unusual enough that it\u0027s reasonable to expect the caller to use ``close_on_exit \u003d False``?","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"67854287a4e45bedfc7d7eee0a87a03bfc144943","unresolved":true,"context_lines":[{"line_number":3727,"context_line":"            raise"},{"line_number":3728,"context_line":""},{"line_number":3729,"context_line":"    def next(self):"},{"line_number":3730,"context_line":"        return self.__next__()"},{"line_number":3731,"context_line":""},{"line_number":3732,"context_line":"    def close(self):"},{"line_number":3733,"context_line":"        for wrapped in self.iters_to_close:"}],"source_content_type":"text/x-python","patch_set":2,"id":"a1b46ddb_695c4916","line":3730,"updated":"2024-01-11 19:23:39.000000000","message":"IIRC this couldn\u0027t be next \u003d __next__ if we\u0027re overriding ... something to do with dunder-method name mangling maybe ... but maybe it\u0027s ok now I\u0027m overriding _get_next_item","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"fa9a08671d31a66d7dbfbfd4ffa621436f7dec00","unresolved":false,"context_lines":[{"line_number":3727,"context_line":"            raise"},{"line_number":3728,"context_line":""},{"line_number":3729,"context_line":"    def next(self):"},{"line_number":3730,"context_line":"        return self.__next__()"},{"line_number":3731,"context_line":""},{"line_number":3732,"context_line":"    def close(self):"},{"line_number":3733,"context_line":"        for wrapped in self.iters_to_close:"}],"source_content_type":"text/x-python","patch_set":2,"id":"58727d37_d260ed78","line":3730,"in_reply_to":"3b7251f3_c64fec07","updated":"2024-01-12 14:32:51.000000000","message":"Done","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"53d5d9b4d043ed9b4840416aec0d88a35b348614","unresolved":true,"context_lines":[{"line_number":3727,"context_line":"            raise"},{"line_number":3728,"context_line":""},{"line_number":3729,"context_line":"    def next(self):"},{"line_number":3730,"context_line":"        return self.__next__()"},{"line_number":3731,"context_line":""},{"line_number":3732,"context_line":"    def close(self):"},{"line_number":3733,"context_line":"        for wrapped in self.iters_to_close:"}],"source_content_type":"text/x-python","patch_set":2,"id":"3b7251f3_c64fec07","line":3730,"in_reply_to":"a1b46ddb_695c4916","updated":"2024-01-11 20:54:52.000000000","message":"Yeah, it\u0027d be an issue of `StringAlong.__next__` having its own implementation while `StringAlong.next is ClosingIterator.__next__` -- probably could ditch it now? I sure _hope_ we succeed in ditching py2 before we come up with some reason that we\u0027d ever want to **actually** override `__next__` instead of `_get_next_item`...\n\nWe might want to throw in a `# py2` somewhere to make it more likely to get dropped when the time comes, though.","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"53d5d9b4d043ed9b4840416aec0d88a35b348614","unresolved":true,"context_lines":[{"line_number":3742,"context_line":""},{"line_number":3743,"context_line":"    def __init__(self, *iterables):"},{"line_number":3744,"context_line":"        super(CloseableChain, self).__init__("},{"line_number":3745,"context_line":"            itertools.chain(*iterables), iterables)"},{"line_number":3746,"context_line":""},{"line_number":3747,"context_line":""},{"line_number":3748,"context_line":"def reiterate(iterable):"}],"source_content_type":"text/x-python","patch_set":2,"id":"2dc04d66_b6d693e9","line":3745,"updated":"2024-01-11 20:54:52.000000000","message":"Oh, I think I quite like that... maybe worth a temp var, like\n```\nchained_iter \u003d itertools.chain(*iterables)\nsuper(CloseableChain, self).__init__(chained_iter, iterables)\n```\nthough? \\*shrug\\*","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"fa9a08671d31a66d7dbfbfd4ffa621436f7dec00","unresolved":false,"context_lines":[{"line_number":3742,"context_line":""},{"line_number":3743,"context_line":"    def __init__(self, *iterables):"},{"line_number":3744,"context_line":"        super(CloseableChain, self).__init__("},{"line_number":3745,"context_line":"            itertools.chain(*iterables), iterables)"},{"line_number":3746,"context_line":""},{"line_number":3747,"context_line":""},{"line_number":3748,"context_line":"def reiterate(iterable):"}],"source_content_type":"text/x-python","patch_set":2,"id":"0998a318_bcd5db5b","line":3745,"in_reply_to":"2dc04d66_b6d693e9","updated":"2024-01-12 14:32:51.000000000","message":"Done","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"67854287a4e45bedfc7d7eee0a87a03bfc144943","unresolved":true,"context_lines":[{"line_number":4431,"context_line":"    yield terminator"},{"line_number":4432,"context_line":""},{"line_number":4433,"context_line":""},{"line_number":4434,"context_line":"class StringAlong(ClosingIterator):"},{"line_number":4435,"context_line":""},{"line_number":4436,"context_line":"    def __init__(self, iterable, other_iter, logger):"},{"line_number":4437,"context_line":"        super(StringAlong, self).__init__(iterable, [other_iter],"}],"source_content_type":"text/x-python","patch_set":2,"id":"08525d2d_086f3539","line":4434,"updated":"2024-01-11 19:23:39.000000000","message":"if we like this idea then this should get some tests","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"53d5d9b4d043ed9b4840416aec0d88a35b348614","unresolved":true,"context_lines":[{"line_number":4437,"context_line":"        super(StringAlong, self).__init__(iterable, [other_iter],"},{"line_number":4438,"context_line":"                                          close_on_exit\u003dTrue)"},{"line_number":4439,"context_line":"        self.other_iter \u003d other_iter"},{"line_number":4440,"context_line":"        self.logger \u003d logger"},{"line_number":4441,"context_line":""},{"line_number":4442,"context_line":"    def _get_next_item(self):"},{"line_number":4443,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"4a6de08e_281dccaf","line":4440,"updated":"2024-01-11 20:54:52.000000000","message":"Do we want to add `__slots__` for `other_iter` and `logger`?","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"fa9a08671d31a66d7dbfbfd4ffa621436f7dec00","unresolved":false,"context_lines":[{"line_number":4437,"context_line":"        super(StringAlong, self).__init__(iterable, [other_iter],"},{"line_number":4438,"context_line":"                                          close_on_exit\u003dTrue)"},{"line_number":4439,"context_line":"        self.other_iter \u003d other_iter"},{"line_number":4440,"context_line":"        self.logger \u003d logger"},{"line_number":4441,"context_line":""},{"line_number":4442,"context_line":"    def _get_next_item(self):"},{"line_number":4443,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"b50c407d_b482ae09","line":4440,"in_reply_to":"4a6de08e_281dccaf","updated":"2024-01-12 14:32:51.000000000","message":"Done","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"67854287a4e45bedfc7d7eee0a87a03bfc144943","unresolved":true,"context_lines":[{"line_number":4451,"context_line":"                self.logger.warning("},{"line_number":4452,"context_line":"                    \"More than one part in a single-part response?\")"},{"line_number":4453,"context_line":"            finally:"},{"line_number":4454,"context_line":"                raise"},{"line_number":4455,"context_line":""},{"line_number":4456,"context_line":""},{"line_number":4457,"context_line":"def document_iters_to_http_response_body(ranges_iter, boundary, multipart,"}],"source_content_type":"text/x-python","patch_set":2,"id":"f02eb78f_8c9c2a9d","line":4454,"updated":"2024-01-11 19:23:39.000000000","message":"raise here and let the superclass __next__ catch it and take care of closing the iters.\n\nI quite like the separation of concerns.","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"53d5d9b4d043ed9b4840416aec0d88a35b348614","unresolved":false,"context_lines":[{"line_number":4451,"context_line":"                self.logger.warning("},{"line_number":4452,"context_line":"                    \"More than one part in a single-part response?\")"},{"line_number":4453,"context_line":"            finally:"},{"line_number":4454,"context_line":"                raise"},{"line_number":4455,"context_line":""},{"line_number":4456,"context_line":""},{"line_number":4457,"context_line":"def document_iters_to_http_response_body(ranges_iter, boundary, multipart,"}],"source_content_type":"text/x-python","patch_set":2,"id":"53e2640f_0298ee97","line":4454,"in_reply_to":"f02eb78f_8c9c2a9d","updated":"2024-01-11 20:54:52.000000000","message":"Acknowledged","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"05e5016c3949217a8a0ba4fe8c5896c448c9efb6","unresolved":true,"context_lines":[{"line_number":3698,"context_line":"    ``_get_next_item``."},{"line_number":3699,"context_line":""},{"line_number":3700,"context_line":"    :param iterable: iterator to wrap."},{"line_number":3701,"context_line":"    :param other_closeables: other iterators to attempt to close."},{"line_number":3702,"context_line":"    :param close_on_exit: if True the"},{"line_number":3703,"context_line":"    \"\"\""},{"line_number":3704,"context_line":"    __slots__ \u003d (\u0027closeables\u0027, \u0027wrapped_iter\u0027, \u0027close_on_exit\u0027)"}],"source_content_type":"text/x-python","patch_set":3,"id":"c10f3ffe_7fddc6c8","line":3701,"range":{"start_line":3701,"start_character":35,"end_line":3701,"end_character":44},"updated":"2024-01-13 06:17:47.000000000","message":"Still says \"iterators\" ;-)","commit_id":"154c3e1e1cc0e9f765fca55cd8726d5130a39784"}],"test/unit/common/test_utils.py":[{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"53d5d9b4d043ed9b4840416aec0d88a35b348614","unresolved":true,"context_lines":[{"line_number":9541,"context_line":"                         [it.close_call_count for it in others + [wrapped]])"},{"line_number":9542,"context_line":"        it.close()"},{"line_number":9543,"context_line":"        self.assertEqual([1, 1, 1],"},{"line_number":9544,"context_line":"                         [it.close_call_count for it in others + [wrapped]])"},{"line_number":9545,"context_line":""},{"line_number":9546,"context_line":"    def test_close_on_exit(self):"},{"line_number":9547,"context_line":"        wrapped \u003d FakeIterable([1, 2, 3])"}],"source_content_type":"text/x-python","patch_set":2,"id":"31b2c996_5b398bae","line":9544,"updated":"2024-01-11 20:54:52.000000000","message":"py2, what are you doing??\n```\nE       - [1, 1, 1]\nE       ?  ^  ^\nE       \nE       + [0, 0, 1]\nE       ?  ^  ^\n\ntest/unit/common/test_utils.py:9544: AssertionError\n```","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"05e5016c3949217a8a0ba4fe8c5896c448c9efb6","unresolved":false,"context_lines":[{"line_number":9541,"context_line":"                         [it.close_call_count for it in others + [wrapped]])"},{"line_number":9542,"context_line":"        it.close()"},{"line_number":9543,"context_line":"        self.assertEqual([1, 1, 1],"},{"line_number":9544,"context_line":"                         [it.close_call_count for it in others + [wrapped]])"},{"line_number":9545,"context_line":""},{"line_number":9546,"context_line":"    def test_close_on_exit(self):"},{"line_number":9547,"context_line":"        wrapped \u003d FakeIterable([1, 2, 3])"}],"source_content_type":"text/x-python","patch_set":2,"id":"631d3c8b_0194d845","line":9544,"in_reply_to":"27abb42d_d3f763aa","updated":"2024-01-13 06:17:47.000000000","message":"🤯 Of course!","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"},{"author":{"_account_id":7847,"name":"Alistair Coles","email":"alistairncoles@gmail.com","username":"acoles"},"change_message_id":"fa9a08671d31a66d7dbfbfd4ffa621436f7dec00","unresolved":true,"context_lines":[{"line_number":9541,"context_line":"                         [it.close_call_count for it in others + [wrapped]])"},{"line_number":9542,"context_line":"        it.close()"},{"line_number":9543,"context_line":"        self.assertEqual([1, 1, 1],"},{"line_number":9544,"context_line":"                         [it.close_call_count for it in others + [wrapped]])"},{"line_number":9545,"context_line":""},{"line_number":9546,"context_line":"    def test_close_on_exit(self):"},{"line_number":9547,"context_line":"        wrapped \u003d FakeIterable([1, 2, 3])"}],"source_content_type":"text/x-python","patch_set":2,"id":"27abb42d_d3f763aa","line":9544,"in_reply_to":"31b2c996_5b398bae","updated":"2024-01-12 14:32:51.000000000","message":"actually, \u0027acoles what are you doing??\u0027 - reusing \u0027it\u0027 var name in the list comprehension 😞","commit_id":"a1d9cf95888e901b7c8043ce0a0162a55b9ce93a"}]}
