python / python/cpython

`Py_SETREF` and `Py_NewRef` is not explained in extending new types using a C extension

Open
#101,233 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

Documentation

The documentation for extending new types using a C extension just uses Py_SETREF and Py_NewRef with no extra clarification as to what those functions do. It'd be nicer and more convenient if they were explained on-the-spot instead of having to search for it in the docs. They are also not explained in the previous topic (that explains Py_INCREF and Py_DECREF) and the other topics thereafter.

Linked PRs
  • gh-101234

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 with the “Providing finer control over data attributes” section of the linked new types tutorial. Explain Py_SETREF and Py_NewRef where they are used, and check the surrounding reference-counting topics for consistent coverage; the documentation is done when readers can understand both functions without searching elsewhere.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.