Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Py_PACK_VERSION macros #128629

Closed
encukou opened this issue Jan 8, 2025 · 0 comments
Closed

Add Py_PACK_VERSION macros #128629

encukou opened this issue Jan 8, 2025 · 0 comments
Assignees
Labels
topic-C-API type-feature A feature request or enhancement

Comments

@encukou
Copy link
Member

encukou commented Jan 8, 2025

Add these to limited API:

  • Py_PACK_FULL_VERSION(x, y, z, level, serial): pack a version number from components
    into the format used by Py_VERSION_HEX and Py_LIMITED_API.
    For example, Py_PACK_FULL_VERSION(3, 14, 0, 0xA, 1) evaluates to 0x030E00A1.

  • Py_PACK_VERSION(x, y): shorthand for Py_PACK_FULL_VERSION(x, y, 0, 0, 0),
    useful because the first two version components often determine ABI
    compatibility.

These are primarily macros, but we will export library functions with the same names and functionality, for use in wrappers for non-C languages – for example, Python with ctypes.

The functions take int arguments and return uint32_t. Inputs are masked (high bits are ignored).

C API WG decision: capi-workgroup/decisions#47

Linked PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-C-API type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants