Skip to content

Python 3.14: EventEmitter uses deprecated asyncio.iscoroutinefunction #790

Description

@aviadr1

Description

livekit 1.1.14 emits a DeprecationWarning on Python 3.14 whenever an RTC callback is registered because livekit/rtc/event_emitter.py calls asyncio.iscoroutinefunction. That API is deprecated in Python 3.14 and slated for removal in Python 3.16; inspect.iscoroutinefunction is the supported replacement.

Reproduction

from livekit.rtc.event_emitter import EventEmitter

emitter = EventEmitter()
emitter.on("event", lambda: None)

Run with Python 3.14 and warnings enabled:

python -W default::DeprecationWarning reproduction.py

Observed warning:

livekit/rtc/event_emitter.py:160: DeprecationWarning: asyncio.iscoroutinefunction is deprecated and slated for removal in Python 3.16; use inspect.iscoroutinefunction() instead

Environment

  • Python 3.14.0
  • livekit 1.1.14
  • Linux x86_64

Suggested change

Import iscoroutinefunction from inspect and use it at the callback validation site. A regression test with DeprecationWarning promoted to an error on Python 3.14 would prevent recurrence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions