Skip to content

gh-141004: Document Py_ARRAY_LENGTH macro#141601

Merged
ZeroIntensity merged 12 commits intopython:mainfrom
Yashp002:main
Nov 24, 2025
Merged

gh-141004: Document Py_ARRAY_LENGTH macro#141601
ZeroIntensity merged 12 commits intopython:mainfrom
Yashp002:main

Conversation

@Yashp002
Copy link
Contributor

@Yashp002 Yashp002 commented Nov 15, 2025

This PR adds documentation for the Py_ARRAY_LENGTH macro to the C API documentation, addressing issue #141004.

The documentation is placed in the "Useful macros" section of Doc/c-api/intro.rst and includes:

  • A description of the macro's purpose (computing array length at compile time)
  • A warning that it must be used with C arrays, not pointers
  • An explanation that it's equivalent to sizeof(array) / sizeof((array)[0])

This macro has existed since Python 2.7 but was previously undocumented in the official C API documentation.


📚 Documentation preview 📚: https://cpython-previews--141601.org.readthedocs.build/

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants