https://github.com/python/cpython/commit/17c5d6d58dcb7c94757fdedac500d6e7ac1ce40e commit: 17c5d6d58dcb7c94757fdedac500d6e7ac1ce40e branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: ZeroIntensity <[email protected]> date: 2025-11-24T13:40:01Z summary:
[3.14] gh-141004: Document `Py_ARRAY_LENGTH` (GH-141601) (GH-141895) gh-141004: Document `Py_ARRAY_LENGTH` (GH-141601) (cherry picked from commit e0773eacb7e660b4fd6bd702b0a119e25ab3b012) Co-authored-by: Yashraj <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]> Co-authored-by: Bénédikt Tran <[email protected]> Co-authored-by: Peter Bierma <[email protected]> files: M Doc/c-api/intro.rst diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst index 58409590c93b0a..3a0c4c8e96068b 100644 --- a/Doc/c-api/intro.rst +++ b/Doc/c-api/intro.rst @@ -322,6 +322,19 @@ complete listing. PyDoc_VAR(python_doc) = PyDoc_STR("A genus of constricting snakes in the Pythonidae family native " "to the tropics and subtropics of the Eastern Hemisphere."); +.. c:macro:: Py_ARRAY_LENGTH(array) + + Compute the length of a statically allocated C array at compile time. + + The *array* argument must be a C array with a size known at compile time. + Passing an array with an unknown size, such as a heap-allocated array, + will result in a compilation error on some compilers, or otherwise produce + incorrect results. + + This is roughly equivalent to:: + + sizeof(array) / sizeof((array)[0]) + .. _api-objects: _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
