Skip to content

Proposal to add Py_IsFinalizing() to the limited API/stable ABI #110397

Closed
@wjakob

Description

@wjakob

Feature or enhancement

Proposal:

Bigger Python extension projects sometimes need to check whether the interpreter is in the process of shutting down to determine if certain operations may be safely executed (PyEval_RestoreThread, Py_DECREF, etc.). Making a mistake here would cause a segfault, and the functions Py_IsFinalizing (previously _Py_IsFinalizing) are important to keep that from happening.

Just recently, this function was deleted, then re-added to the public API (#108014). However, it is not part of the limited API and therefore cannot be used in extension modules targeting the stable ABI.

The purpose of this ticket is to start a discussion on whether this function could be exposed as part of these longer-term stable interfaces.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions