API and ABI Versioning - Python 3.10.9 documentation 编辑

CPython exposes its version number in the following macros. Note that these correspond to the version code is built with, not necessarily the version used at run time.

See C API Stability for a discussion of API and ABI stability across versions.

PY_MAJOR_VERSION

The 3 in 3.4.1a2.

PY_MINOR_VERSION

The 4 in 3.4.1a2.

PY_MICRO_VERSION

The 1 in 3.4.1a2.

PY_RELEASE_LEVEL

The a in 3.4.1a2. This can be 0xA for alpha, 0xB for beta, 0xC for release candidate or 0xF for final.

PY_RELEASE_SERIAL

The 2 in 3.4.1a2. Zero for final releases.

PY_VERSION_HEX

The Python version number encoded in a single integer.

The underlying version information can be found by treating it as a 32 bit number in the following manner:

Bytes

Bits (big endian order)

Meaning

Value for 3.4.1a2

1

1-8

PY_MAJOR_VERSION

0x03

2

9-16

PY_MINOR_VERSION

0x04

3

17-24

PY_MICRO_VERSION

0x01

4

25-28

PY_RELEASE_LEVEL

0xA

29-32

PY_RELEASE_SERIAL

0x2

Thus 3.4.1a2 is hexversion 0x030401a2 and 3.10.0 is hexversion 0x030a00f0.

All the given macros are defined in Include/patchlevel.h.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:83 次

字数:2575

最后编辑:8年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文