python / python/cpython

Clarify the situation with the memory allocation for `PyConfig.home`

Open
#100,251 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

https://docs.python.org/3/c-api/init_config.html#c.PyConfig.home

Empirically, it seems that CPython expects this value to be allocated with malloc() as it will try to free() it when finalizing the environment. This is in stark contrast to the now deprecated Py_SetPythonHome which expected that the value is statically allocated.

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 PyConfig.home entry in the C API initialization-configuration documentation and compare its stated ownership rules with the deprecated Py_SetPythonHome behavior. Verify whether the value must be allocated with malloc() and freed by CPython, then update the documentation to clearly describe the required allocation and lifetime.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.