API와 ABI 버전 붙이기¶
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¶
3.4.1a2의3.
-
PY_MINOR_VERSION¶
3.4.1a2의4.
-
PY_MICRO_VERSION¶
3.4.1a2의1.
-
PY_RELEASE_LEVEL¶
3.4.1a2의a. 알파는0xA, 베타는0xB, 배포 후보는0xC, 최종은0xF가 될 수 있습니다.
-
PY_RELEASE_SERIAL¶
3.4.1a2의2. 최종 배포는 0.
-
PY_VERSION_HEX¶
단일 정수로 인코딩된 파이썬 버전 번호.
기본 버전 정보는 다음과 같은 방식으로 32비트 숫자로 처리하여 찾을 수 있습니다:
바이트
비트 (빅 엔디안 순서)
뜻
3.4.1a2일 때의 값1
1-8
PY_MAJOR_VERSION0x032
9-16
PY_MINOR_VERSION0x043
17-24
PY_MICRO_VERSION0x014
25-28
PY_RELEASE_LEVEL0xA29-32
PY_RELEASE_SERIAL0x2따라서
3.4.1a2는 16진수 버전0x030401a2이고3.10.0은 16진수 버전0x030a00f0입니다.Use this for numeric comparisons, e.g.
#if PY_VERSION_HEX >= ....This version is also available via the symbol
Py_Version.
-
const unsigned long Py_Version¶
- Part of the 안정 ABI 버전 3.11 이후로.
The Python runtime version number encoded in a single constant integer, with the same format as the
PY_VERSION_HEXmacro. This contains the Python version used at run time.버전 3.11에 추가.
모든 주어진 매크로는 Include/patchlevel.h에 정의됩니다.