Skip to content

C API: Deprecate PyImport_ImportModuleNoBlock() function #105396

Closed

Description

@vstinner

The PyImport_ImportModuleNoBlock() function is an alias to PyImport_ImportModule() since Python 3.3. I propose to deprecate it and schedule its removal in Python 3.15.

Linked PRs

Activity

  1. added a commit that references this issue on Jun 6, 2023
  2. vstinner commented on Jun 6, 2023

    @vstinner
    MemberAuthor

    The PyImport_ImportModuleNoBlock() function is an alias to PyImport_ImportModule() since Python 3.3.

    It's related to this main importlib change in Python 3.3: A Finer-Grained Import Lock

    Previous versions of CPython have always relied on a global import lock. This led to unexpected annoyances, such as deadlocks when importing a module would trigger code execution in a different thread as a side-effect. Clumsy workarounds were sometimes employed, such as the PyImport_ImportModuleNoBlock() C API function.


    I propose to deprecate it and schedule its removal in Python 3.15.

    Since the function is part of the stable ABI, it has to stay at the ABI level, but will be removed from the C API level.

  3. added a commit that references this issue on Jun 9, 2023
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions