[issue26923] asyncio.gather drops cancellation

2016-10-21 Thread Yury Selivanov
Yury Selivanov added the comment: Thank you, Johannes! -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___

[issue26923] asyncio.gather drops cancellation

2016-10-21 Thread Roundup Robot
Roundup Robot added the comment: New changeset b1aa485fad1b by Yury Selivanov in branch '3.5': Issue #26923: Fix asyncio.Gather to refuse being cancelled once all children are done. https://hg.python.org/cpython/rev/b1aa485fad1b New changeset b0af901b1e2a by Yury Selivanov in branch '3.6': Merg

[issue26923] asyncio.gather drops cancellation

2016-06-22 Thread Johannes Ebke
Johannes Ebke added the comment: Attached is a new version of the patch incorporating the review results. -- Added file: http://bugs.python.org/file43508/fix_and_test_26923_reviewed.patch ___ Python tracker ___

[issue26923] asyncio.gather drops cancellation

2016-06-20 Thread Yury Selivanov
Yury Selivanov added the comment: > @Yury, any comments? The fix looks fine to me. I've left a comment in code review. Other than that, the patch/approach looks good. -- ___ Python tracker ___

[issue26923] asyncio.gather drops cancellation

2016-06-20 Thread Guido van Rossum
Guido van Rossum added the comment: @Yury, any comments? The fix looks fine to me. -- ___ Python tracker ___ ___ Python-bugs-list mail

[issue26923] asyncio.gather drops cancellation

2016-06-20 Thread Johannes Ebke
Johannes Ebke added the comment: Right, that's neater. Attached is a patch with your version and a test. I checked that it fails with the old version of cancel() and passes with the new one. Concerning possible other bugs, I've had a look in the standard library, but could not find another in

[issue26923] asyncio.gather drops cancellation

2016-06-17 Thread Guido van Rossum
Guido van Rossum added the comment: Thanks! I had eventually pieced together the same explanation. So yes, I think your fix is right, though I would write it like this: ret = False for child in self._children: ret |= child.cancel() return ret # True if at lea

[issue26923] asyncio.gather drops cancellation

2016-06-15 Thread Johannes Ebke
Johannes Ebke added the comment: On rereading my original description, it really is not clearly described why the calling Task ends up surviving. Attached is a patch to the 3.5.1 asyncio/tasks.py which adds some print statements in Task.cancel(). If I execute the cancellation_test.py with th

[issue26923] asyncio.gather drops cancellation

2016-06-14 Thread Guido van Rossum
Guido van Rossum added the comment: I think I agree with Johannes. If all children refuse to be cancelled because they are already done, the outer _GatheringFuture might as well refuse to be cancelled as well. However I'm not sure I actually understand the mechanism whereby the calling Task e

[issue26923] asyncio.gather drops cancellation

2016-06-14 Thread Martin Altmayer
Martin Altmayer added the comment: I don't think this is a mere documentation problem: If a future cannot be cancelled because it is already done, cancel must return False. As Johannes' example demonstrates, a wrong return value from cancel might lead to a cancelled task being continued as if

[issue26923] asyncio.gather drops cancellation

2016-05-04 Thread Mathias Arens
Changes by Mathias Arens : -- nosy: +tatellos ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue26923] asyncio.gather drops cancellation

2016-05-03 Thread Johannes Ebke
Johannes Ebke added the comment: Thank you for providing the relevant documentation link. I just noticed that it should probably be clarified that in case the outer Future is cancelled, and all children that are not already done ignore the cancellation (a.k.a. catch the CancelledError), the ca

[issue26923] asyncio.gather drops cancellation

2016-05-03 Thread STINNER Victor
STINNER Victor added the comment: The doc: https://docs.python.org/dev/library/asyncio-task.html#asyncio.gather "Cancellation: if the outer Future is cancelled, all children (that have not completed yet) are also cancelled. If any child is cancelled, this is treated as if it raised CancelledErr

[issue26923] asyncio.gather drops cancellation

2016-05-03 Thread Johannes Ebke
New submission from Johannes Ebke: In a very specific case, asyncio.gather causes a cancel() call on the Task waiting on the _GatheringFuture to return a false positive. An example program demonstrating this is attached. The context: asyncio.gather creates a _GatheringFuture with a list of chi