Skip to content

asyncio.events.BaseDefaultEventLoopPolicy gone from Python 3.14 without prior deprecation #131148

Closed as not planned

Description

@hroncok

Bug report

Bug description:

from asyncio.events import BaseDefaultEventLoopPolicy

This is from https://github.com/MagicStack/uvloop/blob/7bb12a174884b2ec8b3162a08564e5fb8a5c6b39/uvloop/__init__.py#L6 cc @fantix

On Python 3.13, this works.
On Python 3.14 since #128216 this no longer works and raises ImportError. As far as I know, the class was not deprecated in 3.13 or 3.12.

>>> from asyncio.events import BaseDefaultEventLoopPolicy
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    from asyncio.events import BaseDefaultEventLoopPolicy
ImportError: cannot import name 'BaseDefaultEventLoopPolicy' from 'asyncio.events' (/usr/lib64/python3.14/asyncio/events.py)

The commit message of #128216 does not mention any API removals at all. It has no NEWS either, so I assume this removal was accidental.

CPython versions tested on:

3.14, CPython main branch

Operating systems tested on:

Linux

Activity

  1. picnixz commented on Mar 12, 2025

    @picnixz
    Member

    I'm not sure this was meant to actually be publicly exposed. Policies were deprecated since 3.12 and asyncio.events.BaseDefaultEventLoopPolicy has probably not been intended to be public (I can't find it documented anywhere). cc @kumaraditya303

    Note that it's not really gone, just that it has been now named as really "private" (but maybe it should have been kept half-public?)

  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    3.14bugs and security fixes
    on Mar 12, 2025
  3. hroncok commented on Mar 12, 2025

    @hroncok
    ContributorAuthor

    As a workaround, from asyncio.events import _BaseDefaultEventLoopPolicy currently works, indeed.

    I realize this was probably never meant to be a public API. It just kinda was.

  4. kumaraditya303 commented on Mar 12, 2025

    @kumaraditya303
    Contributor

    BaseDefaultEventLoopPolicy is an undocumented and private class of a private submodule of asyncio. Only the stuff exposed from toplevel asyncio and that is documented is considered public.

    uvloop should change its code to not use private class and instead use abstract policy class.

  5. picnixz commented on Mar 12, 2025

    @picnixz
    Member

    I realize this was probably never meant to bea public API. It just kinda was.

    Yes, it's something we had a lot in Sphinx where we named private objects with public names and didn't document them / export them, making them implicitly private, but not everyone assumes this kind of convention, which then makes refactoring usually breaking.

    As for whether the lack of a changelog entry, it has been added afterwards (#128269 and #128290)

  6. kumaraditya303 commented on Mar 28, 2025

    @kumaraditya303
    Contributor

    Closing as it is wont-fix

  7. moved this from Todo to Done in asyncioon Mar 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytopic-asynciotype-bugAn unexpected behavior, bug, or error

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions