Skip to content

Commit b22b964

Browse files
encukoumeadoriStanFromIreland
authored
gh-57089: Note _layout_ in the bitfield docs (GH-134148)
Co-authored-by: Meador Inge <meadori@gmail.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
1 parent 1adca08 commit b22b964

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Doc/library/ctypes.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -714,10 +714,16 @@ item in the :attr:`~Structure._fields_` tuples::
714714
... ("second_16", c_int, 16)]
715715
...
716716
>>> print(Int.first_16)
717-
<Field type=c_long, ofs=0:0, bits=16>
717+
<ctypes.CField 'first_16' type=c_int, ofs=0, bit_size=16, bit_offset=0>
718718
>>> print(Int.second_16)
719-
<Field type=c_long, ofs=0:16, bits=16>
720-
>>>
719+
<ctypes.CField 'second_16' type=c_int, ofs=0, bit_size=16, bit_offset=16>
720+
721+
It is important to note that bit field allocation and layout in memory are not
722+
defined as a C standard; their implementation is compiler-specific.
723+
By default, Python will attempt to match the behavior of a "native" compiler
724+
for the current platform.
725+
See the :attr:`~Structure._layout_` attribute for details on the default
726+
behavior and how to change it.
721727

722728

723729
.. _ctypes-arrays:

0 commit comments

Comments
 (0)