Skip to content

Deprecation warnings while using Sanic with Python 3.14 #3097

@aellwein

Description

@aellwein

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

There are several deprecation warnings running Sanic (25.3.0 in my case) with Python 3.14

/Users/xxx/git/project/.venv/lib/python3.14/site-packages/sanic/server/loop.py:46: DeprecationWarning: 'asyncio.get_event_loop_policy' is deprecated and slated for removal in Python 3.16
  if not isinstance(asyncio.get_event_loop_policy(), uvloop.EventLoopPolicy):

/Users/xxx/git/project/.venv/lib/python3.14/site-packages/sanic/server/loop.py:47: DeprecationWarning: 'asyncio.set_event_loop_policy' is deprecated and slated for removal in Python 3.16
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())

/Users/xxx/git/project/.venv/lib/python3.14/site-packages/sanic/server/runners.py:174: DeprecationWarning: 'asyncio.iscoroutinefunction' is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead

also noteworthy warning:

/app/.venv/lib/python3.14/site-packages/sanic/server/websockets/impl.py:439: SyntaxWarning: 'return' in a 'finally' block
  return
/app/.venv/lib/python3.14/site-packages/sanic/server/websockets/impl.py:465: SyntaxWarning: 'return' in a 'finally' block
  return

Code snippet

No response

Expected Behavior

no warnings

How do you run Sanic?

Sanic CLI

Operating System

MacOS

Sanic Version

25.3.0

Additional context

checked on MacOS / Linux (Docker) - same output noticed

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions