Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Addsys.abi_info to make information about the interpreter ABI more accessible #133143

Closed
Labels
extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement
@zklaus

Description

@zklaus

Feature or enhancement

Proposal:

Early on in the discussion ofPEP 780: ABI features as environment markers a certain shortcoming of ABI information availability was identified and discussed.
One suggestion was to adopt a new mechanism for making this kind of information available, which initially was included as a proposal in PEP 780 itself. However, that PEP is aimed at improving the packaging situation and to improve that focus, the addition to the standard library is no longer part of it.

Here, we propose to add ABI information to the standard library in the form of a new attribute to thesys module.

In PEP 780 three ABI features are identified, namely

  • free-threading orgil-enabled (only CPython)
    If the Python interpreter is free-threaded, thefree-threading feature MUST be present and thegil-enabled feature MUST NOT be present. Otherwise, thegil-enabled feature MUST be present and thefree-threading feature MUST NOT be present.

  • debug (only CPython, optional)
    This ABI feature is reserved for the--with-pydebug build of CPython. If the interpreter is a CPython interpreter withPy_DEBUG capabilities, thedebug feature MUST be present. On POSIX systems, this corresponds to the Python expression"d" in sys.abiflags.

  • 32-bit or64-bit (optional)
    The bitness of the interpreter, that is, whether it is a 32-bit or 64-bit build. If the bitness is unknown or neither 32-bit nor 64-bit, this feature MUST NOT be present.

A reference implementation of this featureis available, which adds these features as a frozen set of identifying strings tosys.abi_features.

For purposes of the environment markers defined in PEP 780, only the presence or absence of the features is relevant. However, in the discussion of the reference implementation@FFY00 suggested that a more comprehensive implementation might be useful, for example providing additional information about the ABI features, such as their representation insys.abiflags (which directly impacts their possible representation in the ABI tags used for wheels and extension modules), or their default state.

This addition to the standard library will make crucial ABI information much easier to access.

We think this fully backwards compatible addition can be made with a simple pull request.

It would be great to hear from the CPython team.

Do you agree that this is a useful feature?

Do you think detailed information beyond simple presence or absence of ABI features should be included?

Do you have suggestions for the exact API?

Has this already been discussed elsewhere?

I have already discussed this feature proposal on Discourse

Links to previous discussion of this feature:

Initial thoughts on this feature, have surfaced in the discussions leading to PEP 780.
During the discussion of the PEP,further comments weremade, leading to the separation from the PEP with further review commentsavailable.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp