On Tue, Jun 5, 2018 at 2:57 AM, Yury Selivanov <yselivanov...@gmail.com> wrote:
> On Mon, Jun 4, 2018 at 12:50 PM Chris Angelico <ros...@gmail.com> wrote:
>>
>> On Tue, Jun 5, 2018 at 2:11 AM, Victor Stinner <vstin...@redhat.com> wrote:
> [..]
>> > For me, it's fine to catch any exception using "except:" if the block
>> > contains "raise", typical pattern to cleanup a resource in case of
>> > error. Otherwise, there is a risk of leaking open file or not flushing
>> > data on disk, for example.
>>
>> Pardon the dumb question, but why is try/finally unsuitable?
>
> Because try..finally isn't equivalent to try..except?  Perhaps you
> should look at the actual code:
> https://github.com/python/cpython/blob/b609e687a076d77bdd687f5e4def85e29a044bfc/Lib/asyncio/base_events.py#L1117-L1123

Oh. Duh. Yep, it was a dumb question. Sorry! The transport should ONLY
be closed on error.

ChrisA
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to