gh-113050: Pass name
to BaseEventLoop task factory
#113051
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: #113050
The task factory is used in the BaseEventLoop create_task method when set. This commit passes the
name
kwarg to this factory to set the name of the task, instead of setting the task in the loop method. This is more consistent with the eager_task_factory methods.This is consistent with:
asyncio
Eager Task Factory docsasyncio.tasks.create_eager_task_factory
which returns a factory with signaturedef factory(loop, coro, *, name=None, context=None)
.uvloop
is expecting it in its unit testsThis will be a breaking change if and only if:
BaseEventLoop
is subclassed and the subclass does not overridecreate_task
(using the default implementation), andname
kwarg (or**kwargs
).uvloop
will not be affected by this, but I have raised an issue to update their typing to reflect this expectation: MagicStack/uvloop#584📚 Documentation preview 📚: https://cpython-previews--113051.org.readthedocs.build/