Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2043f9c

Browse files
committed
#11901: add description of how bitfields are laid out to hexversion docs
Patch by Sijin Joseph.
1 parent 8f14bbd commit 2043f9c

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

Doc/library/sys.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,29 @@ always available.
450450
``version_info`` value may be used for a more human-friendly encoding of the
451451
same information.
452452

453+
The ``hexversion`` is a 32-bit number with the following layout
454+
455+
+-------------------------+------------------------------------------------+
456+
| bits (big endian order) | meaning |
457+
+=========================+================================================+
458+
| :const:`1-8` | ``PY_MAJOR_VERSION`` (the ``2`` in |
459+
| | ``2.1.0a3``) |
460+
+-------------------------+------------------------------------------------+
461+
| :const:`9-16` | ``PY_MINOR_VERSION`` (the ``1`` in |
462+
| | ``2.1.0a3``) |
463+
+-------------------------+------------------------------------------------+
464+
| :const:`17-24` | ``PY_MICRO_VERSION`` (the ``0`` in |
465+
| | ``2.1.0a3``) |
466+
+-------------------------+------------------------------------------------+
467+
| :const:`25-28` | ``PY_RELEASE_LEVEL`` (``0xA`` for alpha, |
468+
| | ``0xB`` for beta, ``0xC`` for gamma and |
469+
| | ``0xF`` for final) |
470+
+-------------------------+------------------------------------------------+
471+
| :const:`29-32` | ``PY_RELEASE_SERIAL`` (the ``3`` in |
472+
| | ``2.1.0a3``) |
473+
+-------------------------+------------------------------------------------+
474+
475+
thus ``2.1.0a3`` is hexversion ``0x020100a3``
453476

454477
.. data:: int_info
455478

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ Irmen de Jong
411411
Lucas de Jonge
412412
John Jorgensen
413413
Jens B. Jorgensen
414+
Sijin Joseph
414415
Andreas Jung
415416
Tattoo Mabonzo K.
416417
Bob Kahn

0 commit comments

Comments
 (0)