Skip to content

Don't override task factory's eager_start default - #779

Open
chrisjbillington wants to merge 1 commit into
MagicStack:masterfrom
chrisjbillington:fix-eager-task-factory
Open

chrisjbillington wants to merge 1 commit into
MagicStack:masterfrom
chrisjbillington:fix-eager-task-factory

Conversation

@chrisjbillington

Copy link
Copy Markdown

PR #748 introduced a regression by passing eager_start=None to the
task factory when not provided by the caller. On Python 3.14 this is
interpreted as False, overriding asyncio.eager_task_factory's
default of eager_start=True and resulting in non-eager tasks. On
Python 3.13, it's a TypeError , since eager_task_factory and user
factories with the (loop, coro, *, name=None, context=None) signature
do not accept an eager_start argument at all.

Forward eager_start to the factory and to Task only when provided by
the caller. This matches the behaviour of asyncio's loop.

Add tests for behaviour when eager_start=False and when not provided.

Fixes #754 (the TypeError on Python 3.13).

Disclosure: Bug found and patch and tests were written by Claude Fable 5.1. But I can confirm the bug on 3.14 and that this fixes it, and the reason for the regression is obvious.

PR MagicStack#748 introduced a regression by passing `eager_start=None` to the
task factory when not provided by the caller. On Python 3.14 this is
interpreted as `False`, overriding `asyncio.eager_task_factory`'s
default of `eager_start=True` and resulting in non-eager tasks. On
Python 3.13, it's a `TypeError` , since `eager_task_factory` and user
factories with the `(loop, coro, *, name=None, context=None)` signature
do not accept an `eager_start` argument at all.

Forward `eager_start` to the factory and to `Task` only when provided by
the caller. This matches the behaviour of `asyncio`'s loop.

Add tests for behaviour when `eager_start=False` and when not provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: create_task() got an unexpected keyword argument 'eager_start'

1 participant