Skip to content

Python 3.14 deprecation warnings for asyncio.get_event_loop_policy still present in 25.12.0 #3129

@stefanfinseth

Description

@stefanfinseth

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When running Sanic 25.12.0 on Python 3.14, the following deprecation warnings are still emitted:

  /usr/local/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):
  /usr/local/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())
  /usr/local/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
    loop.add_signal_handler(

PR #3115 addressed some Python 3.14 issues but these specific deprecations in loop.py and runners.py were not fixed.

Code snippet

from sanic import Sanic
  from sanic.response import text
  from sanic.worker.loader import AppLoader

  def create_app() -> Sanic:
      app = Sanic("test-app")

      @app.get("/health")
      def health(request):
          return text("OK")

      return app

  def main():
      loader = AppLoader(factory=create_app)
      app = loader.load()
      app.prepare(host="0.0.0.0", port=8080)
      Sanic.serve(primary=app, app_loader=loader)

  if __name__ == "__main__":
      main()

Expected Behavior

No deprecation warnings should be emitted when running on Python 3.14.

How do you run Sanic?

As a script (app.run or Sanic.serve)

Operating System

Linux

Sanic Version

25.12.0

Additional context

Reproduced on both Linux and macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions