[issue27972] Confusing error during cyclic yield

2017-03-31 Thread Donald Stufft
Changes by Donald Stufft : -- pull_requests: +1051 ___ Python tracker ___ ___

[issue27972] Confusing error during cyclic yield

2016-10-10 Thread Max von Tettenborn
Max von Tettenborn added the comment: You are very welcome, glad I could help. -- ___ Python tracker ___ ___

[issue27972] Confusing error during cyclic yield

2016-10-09 Thread Yury Selivanov
Yury Selivanov added the comment: Thank you for reporting this! Closing the issue. -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker

[issue27972] Confusing error during cyclic yield

2016-10-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset 8d877876aa89 by Yury Selivanov in branch '3.5': Issue #27972: Prohibit Tasks to await on themselves. https://hg.python.org/cpython/rev/8d877876aa89 New changeset 41c4f535b5c0 by Yury Selivanov in branch '3.6': Merge 3.5 (issue #27972)

[issue27972] Confusing error during cyclic yield

2016-10-07 Thread Guido van Rossum
Guido van Rossum added the comment: I've meditated on this and I've changed my mind. A task that awaits itself is so obviously not following the task protocol that it should be shot on sight. No exceptions. (Only the task itself should ever set the result or exception, and *only* by returning or

[issue27972] Confusing error during cyclic yield

2016-10-06 Thread Guido van Rossum
Guido van Rossum added the comment: Maybe it could be fixed rather than making this a checked failure? -- ___ Python tracker ___

[issue27972] Confusing error during cyclic yield

2016-10-06 Thread Yury Selivanov
Yury Selivanov added the comment: > Is that enough? What if the recursion involves several tasks waiting for each other in a cycle? I'm not sure... Maybe it's OK when two tasks await on each other, I think the current Task implementation should be able to handle that. The problem with the

[issue27972] Confusing error during cyclic yield

2016-10-06 Thread Yury Selivanov
Yury Selivanov added the comment: > It's pretty perverse. But how would you detect this case? In Task._step, we can check if the future the task is about to await on is "self". -- ___ Python tracker

[issue27972] Confusing error during cyclic yield

2016-10-06 Thread Guido van Rossum
Guido van Rossum added the comment: Is that enough? What if the recursion involves several tasks waiting for each other in a cycle? -- ___ Python tracker

[issue27972] Confusing error during cyclic yield

2016-10-06 Thread Guido van Rossum
Guido van Rossum added the comment: It's pretty perverse. But how would you detect this case? Does it require changes to CPython or only to asyncio? Does it require a spec change anywhere? -- ___ Python tracker

[issue27972] Confusing error during cyclic yield

2016-10-06 Thread Yury Selivanov
Yury Selivanov added the comment: This is an interesting mind twister. The key problem is that `self.runner_task` is blocked on *itself*: so Task._fut_waiter is set to the Task. Therefore when the task is being cancelled, `Task.cancel` simply recurses. One way to solve this is to prohibit

[issue27972] Confusing error during cyclic yield

2016-09-06 Thread Guido van Rossum
Guido van Rossum added the comment: Thanks for the report. I've never seen this before, so I doubt it is a common mistake. Yury have you ever seen this? --Guido (mobile) -- ___ Python tracker

[issue27972] Confusing error during cyclic yield

2016-09-06 Thread Max von Tettenborn
New submission from Max von Tettenborn: Below code reproduces the problem. The resulting error is a RecursionError and it is very hard to trace that to the cause of the problem, which is the runner task and the stop task yielding from each other, forming a deadlock. I think, an easy to make