Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore name argument on Python 3.7 #2355

Merged
merged 10 commits into from Jan 6, 2022
10 changes: 9 additions & 1 deletion sanic/app.py
Expand Up @@ -1553,7 +1553,15 @@ def _loop_add_task(
register: bool = True,
) -> Task:
prepped = cls._prep_task(task, app, loop)
task = loop.create_task(prepped, name=name)
if sys.version_info == (3, 7):
if name:
error_logger.warning(
"Cannot set a name for a task when using Python 3.7. Your "
"task will be created without a name."
)
task = loop.create_task(prepped)
else:
task = loop.create_task(prepped, name=name)

if name and register:
app._task_registry[name] = task
Expand Down