gh-128415: store current task on loop #128416
gh-128415: store current task on loop #128416kumaraditya303 wants to merge 2 commits intopython:mainfrom
Conversation
| if (item == NULL || item == Py_None) { | ||
| // current task is not set | ||
| PyErr_Format(PyExc_RuntimeError, | ||
| "Leaving task %R does not match the current task %R.", |
There was a problem hiding this comment.
Having "None" in the message could be a bit confusing. Perhaps something like "Leaving task %R does not match the current task (None)" or "Unexpected leaving task %R"?
| def test__enter_task(self): | ||
| task = mock.Mock() | ||
| loop = mock.Mock() | ||
| class LoopLike: |
There was a problem hiding this comment.
Maybe a module-level class would be better?
| raise RuntimeError(f"Leaving task {task!r} does not match " | ||
| f"the current task {current_task!r}.") | ||
| del _current_tasks[loop] | ||
| f"the current task.") |
| raise RuntimeError(f"Cannot enter into task {task!r} while another " | ||
| f"task {loop._current_task!r} is being executed.") |
There was a problem hiding this comment.
| raise RuntimeError(f"Cannot enter into task {task!r} while another " | |
| f"task {loop._current_task!r} is being executed.") | |
| raise RuntimeError(f"Cannot enter into task {task!r} while another " | |
| f"task {loop._current_task!r} is being executed.") |
| raise RuntimeError(f"Leaving task {task!r} does not match " | ||
| f"the current task {loop._current_task!r}.") |
There was a problem hiding this comment.
| raise RuntimeError(f"Leaving task {task!r} does not match " | |
| f"the current task {loop._current_task!r}.") | |
| raise RuntimeError(f"Leaving task {task!r} does not match " | |
| f"the current task {loop._current_task!r}.") |
|
Thank you for raising the issue! Could you please consider an alternative implementation? Thoughts? |
That would work for things like the storing all the tasks and the eager tasks, but for current task one loop will only ever have one current task so all that isn't needed. Specifically I am saying the even for the loop scoped state we don't need |
|
@kumaraditya303 sorry, I was inaccurate in my comment. |
I see, I have created a new issue #128633 to look more into this. Let's continue the discussion there. |
Uh oh!
There was an error while loading. Please reload this page.