Skip to content

Commit 6650811

Browse files
committed
Fix eager task execution in Python 3.12+
Add eager_start=False when creating tasks in ErlangEventLoop.create_task to prevent eager execution which can cause test failures.
1 parent 25a820f commit 6650811

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

priv/_erlang_impl/_loop.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,11 @@ def create_task(self, coro, *, name=None, context=None):
414414
"""Schedule a coroutine to be executed."""
415415
self._check_closed()
416416
if self._task_factory is None:
417-
if sys.version_info >= (3, 11):
417+
if sys.version_info >= (3, 12):
418+
# Python 3.12+: use eager_start=False to prevent eager execution
419+
task = tasks.Task(coro, loop=self, name=name, context=context,
420+
eager_start=False)
421+
elif sys.version_info >= (3, 11):
418422
task = tasks.Task(coro, loop=self, name=name, context=context)
419423
elif sys.version_info >= (3, 8):
420424
task = tasks.Task(coro, loop=self, name=name)

0 commit comments

Comments
 (0)