python / python/cpython

The Python C API should only define macros with a name starting wit `Py`

Open
#157,695 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

infra topic-C-API
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Currently, the Python C API defines 472 macros with a name which doesn't start with Py, PY, _Py or _PY prefix.

I propose adding a check to prevent adding new macros which doesn't respect this convention. Existing invalid names will be added to an ignore list for now.

Linked PRs
  • gh-157696
  • gh-157752
  • gh-157821

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing linked PRs gh-157696 and gh-157752, then trace how the Python C API macros are currently checked. Done means new macros without a Py, PY, _Py, or _PY prefix are rejected while the existing invalid names are covered by an ignore list.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.