"Can you file a bug for that?"
done!

http://bugs.python.org/issue25291?@ok_message=file%2040650%20created%0Amsg%20252049%20created%0Aissue%2025291%20created&@template=item
 


On Thursday, October 1, 2015 at 1:59:19 PM UTC-4, Guido van Rossum wrote:
>
> On Thu, Oct 1, 2015 at 6:35 AM, Oleg K <[email protected] <javascript:>> 
> wrote:
>
>> i wasn't even thinking about a change, may be better Exception message, 
>> that is all.
>>
>
> I agree the error message is kind of confusing. Can you file a bug for 
> that?
>  
>
>>
>> or event better: immediate exception InvalidStateError just when i 
>> called set_exception to prevent me doing something that "should not be done"
>>
>
> That's not really possible. And I assure you that what you did is highly 
> unusual (it's not a mistake many people would make :-).
>  
>
>> basically that "double error"  StopIteration + InvalidStateError  just 
>> confused me. 
>> because it gave me no trace to the real source of the problem, the 
>> earlier call of "set_exception" which went good (at first glance).
>>
>> i guess that StopIteration just comes from the end of coroutine, because 
>> we iterate over it?
>> that is "natural exception" and it could not exit it properly and created 
>> another.
>>
>
> Yeah, the StopIteration is just the end of the coroutine. It is implicated 
> because the failing set_result() call occurred in the except clause (in 
> _step()) that handled that StopIteration.
>
>>
>> On Thursday, October 1, 2015 at 12:26:21 AM UTC-4, Guido van Rossum wrote:
>>>
>>> There are many excellent reasons why the mechanism I've described won't 
>>> change.
>>>
>>> I guess you could do this:
>>>
>>> try:
>>>     raise RuntimeError
>>> finally:
>>>     <cleanup>
>>>
>>> But personally I would just write
>>>
>>> <cleanup>
>>> raise RuntimeError
>>>
>>> If <cleanup> is a lot of code put it in a helper function.
>>>
>>> --Guido van Rossum (python.org/~guido)
>>>
>>
>
>
> -- 
> --Guido van Rossum (python.org/~guido)
>

Reply via email to