diff options
Diffstat (limited to 'devdocs/python~3.12/c-api%2Fapiabiversion.html')
| -rw-r--r-- | devdocs/python~3.12/c-api%2Fapiabiversion.html | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/devdocs/python~3.12/c-api%2Fapiabiversion.html b/devdocs/python~3.12/c-api%2Fapiabiversion.html new file mode 100644 index 00000000..7ef6a990 --- /dev/null +++ b/devdocs/python~3.12/c-api%2Fapiabiversion.html @@ -0,0 +1,33 @@ + <span id="apiabiversion"></span><h1>API and ABI Versioning</h1> <p>CPython exposes its version number in the following macros. Note that these correspond to the version code is <strong>built</strong> with, not necessarily the version used at <strong>run time</strong>.</p> <p>See <a class="reference internal" href="stable#stable"><span class="std std-ref">C API Stability</span></a> for a discussion of API and ABI stability across versions.</p> <dl class="c macro"> <dt class="sig sig-object c" id="c.PY_MAJOR_VERSION"> +<code>PY_MAJOR_VERSION</code> </dt> <dd> +<p>The <code>3</code> in <code>3.4.1a2</code>.</p> </dd> +</dl> <dl class="c macro"> <dt class="sig sig-object c" id="c.PY_MINOR_VERSION"> +<code>PY_MINOR_VERSION</code> </dt> <dd> +<p>The <code>4</code> in <code>3.4.1a2</code>.</p> </dd> +</dl> <dl class="c macro"> <dt class="sig sig-object c" id="c.PY_MICRO_VERSION"> +<code>PY_MICRO_VERSION</code> </dt> <dd> +<p>The <code>1</code> in <code>3.4.1a2</code>.</p> </dd> +</dl> <dl class="c macro"> <dt class="sig sig-object c" id="c.PY_RELEASE_LEVEL"> +<code>PY_RELEASE_LEVEL</code> </dt> <dd> +<p>The <code>a</code> in <code>3.4.1a2</code>. This can be <code>0xA</code> for alpha, <code>0xB</code> for beta, <code>0xC</code> for release candidate or <code>0xF</code> for final.</p> </dd> +</dl> <dl class="c macro"> <dt class="sig sig-object c" id="c.PY_RELEASE_SERIAL"> +<code>PY_RELEASE_SERIAL</code> </dt> <dd> +<p>The <code>2</code> in <code>3.4.1a2</code>. Zero for final releases.</p> </dd> +</dl> <dl class="c macro"> <dt class="sig sig-object c" id="c.PY_VERSION_HEX"> +<code>PY_VERSION_HEX</code> </dt> <dd> +<p>The Python version number encoded in a single integer.</p> <p>The underlying version information can be found by treating it as a 32 bit number in the following manner:</p> <table class="docutils align-default"> <thead> <tr> +<th class="head"><p>Bytes</p></th> <th class="head"><p>Bits (big endian order)</p></th> <th class="head"><p>Meaning</p></th> <th class="head"><p>Value for <code>3.4.1a2</code></p></th> </tr> </thead> <tr> +<td><p>1</p></td> <td><p>1-8</p></td> <td><p><code>PY_MAJOR_VERSION</code></p></td> <td><p><code>0x03</code></p></td> </tr> <tr> +<td><p>2</p></td> <td><p>9-16</p></td> <td><p><code>PY_MINOR_VERSION</code></p></td> <td><p><code>0x04</code></p></td> </tr> <tr> +<td><p>3</p></td> <td><p>17-24</p></td> <td><p><code>PY_MICRO_VERSION</code></p></td> <td><p><code>0x01</code></p></td> </tr> <tr> +<td rowspan="2"><p>4</p></td> <td><p>25-28</p></td> <td><p><code>PY_RELEASE_LEVEL</code></p></td> <td><p><code>0xA</code></p></td> </tr> <tr> +<td><p>29-32</p></td> <td><p><code>PY_RELEASE_SERIAL</code></p></td> <td><p><code>0x2</code></p></td> </tr> </table> <p>Thus <code>3.4.1a2</code> is hexversion <code>0x030401a2</code> and <code>3.10.0</code> is hexversion <code>0x030a00f0</code>.</p> <p>Use this for numeric comparisons, e.g. <code>#if PY_VERSION_HEX >= ...</code>.</p> <p>This version is also available via the symbol <a class="reference internal" href="#c.Py_Version" title="Py_Version"><code>Py_Version</code></a>.</p> </dd> +</dl> <dl class="c var"> <dt class="sig sig-object c" id="c.Py_Version"> +<code>const unsigned long Py_Version</code> </dt> <dd> +<em class="stableabi"> Part of the <a class="reference internal" href="stable#stable"><span class="std std-ref">Stable ABI</span></a> since version 3.11.</em><p>The Python runtime version number encoded in a single constant integer, with the same format as the <a class="reference internal" href="#c.PY_VERSION_HEX" title="PY_VERSION_HEX"><code>PY_VERSION_HEX</code></a> macro. This contains the Python version used at run time.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.11.</span></p> </div> </dd> +</dl> <p>All the given macros are defined in <a class="reference external" href="https://github.com/python/cpython/tree/3.12/Include/patchlevel.h">Include/patchlevel.h</a>.</p> <div class="_attribution"> + <p class="_attribution-p"> + © 2001–2023 Python Software Foundation<br>Licensed under the PSF License.<br> + <a href="https://docs.python.org/3.12/c-api/apiabiversion.html" class="_attribution-link">https://docs.python.org/3.12/c-api/apiabiversion.html</a> + </p> +</div> |
