@@ -997,6 +997,15 @@ Generally you only use this feature if you receive a pointer from a C function,
997997and you *know * that the pointer actually points to an array instead of a single
998998item.
999999
1000+ .. warning ::
1001+
1002+ Because pointer objects support subscription, they implicitly support
1003+ :term: `iteration <iterator> `. Unless doing this in a controlled manner,
1004+ such as by manually calling :func: `next ` on a :func: `pointer ` iterator, this
1005+ will typically lead to infinite loops or crashes, because ctypes has no way
1006+ of knowing when to stop iteration. In other words, a ``pointer `` iterator
1007+ will infinitely yield arbitrary memory.
1008+
10001009Behind the scenes, the :func: `pointer ` function does more than simply create
10011010pointer instances, it has to create pointer *types * first. This is done with the
10021011:func: `POINTER ` function, which accepts any :mod: `!ctypes ` type, and returns a
@@ -3383,3 +3392,47 @@ Exceptions
33833392 .. availability :: Windows
33843393
33853394 .. versionadded :: 3.14
3395+
3396+
3397+ Library version
3398+ ^^^^^^^^^^^^^^^
3399+
3400+ The following constants are only available if :mod: `!ctypes ` was built with
3401+ libffi 3.5 or later, which is the first version providing this information.
3402+
3403+ .. data :: LIBFFI_VERSION
3404+
3405+ The version string of the libffi library that was used for building
3406+ the module, like ``'3.5.2' ``.
3407+ This may be different from the libffi library actually used at runtime,
3408+ which is available as :const: `libffi_version `.
3409+
3410+ .. versionadded :: next
3411+
3412+ .. data :: libffi_version
3413+
3414+ The version string of the libffi library actually loaded by the interpreter.
3415+
3416+ .. versionadded :: next
3417+
3418+ .. data :: LIBFFI_VERSION_INFO
3419+
3420+ A named tuple containing the three components of the libffi library
3421+ version that was used for building the module:
3422+ *major *, *minor *, and *patch *.
3423+ All values are integers.
3424+ The components can also be accessed by name,
3425+ so ``ctypes.LIBFFI_VERSION_INFO[0] `` is equivalent to
3426+ ``ctypes.LIBFFI_VERSION_INFO.major `` and so on.
3427+ This may be different from the libffi library actually used at runtime,
3428+ which is available as :const: `libffi_version_info `.
3429+
3430+ .. versionadded :: next
3431+
3432+ .. data :: libffi_version_info
3433+
3434+ A named tuple containing the version of the libffi library
3435+ actually loaded by the interpreter,
3436+ with the same fields as :const: `LIBFFI_VERSION_INFO `.
3437+
3438+ .. versionadded :: next
0 commit comments