PYTHONDONTWRITEBYTECODE documentation is incorrect
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Documentation
PYTHONDONTWRITEBYTECODE is documented in Doc/using/cmdline.rst as:
If this is set to a non-empty string, Python won't try to write
.pycfiles on the import of source modules.
This is incorrect. The variable is obtained in Python/initconfig.c as:
int dont_write_bytecode = 0;
_Py_get_env_flag(use_env, &dont_write_bytecode, "PYTHONDONTWRITEBYTECODE");
if (dont_write_bytecode) {
config->write_bytecode = 0;
}
and _Py_get_env_flag reads the environment variable value as integer, treating non-integer string as 1. Specifically, this means that PYTHONDONTWRITEBYTECODE=0 will not suppress writing .pyc files, even though the environment variable is assigned a non-empty string "0".
Linked PRs
- gh-143144
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Doc/using/cmdline.rst and compare the documented behavior with Python/initconfig.c, especially the _Py_get_env_flag call shown in the issue. Update the environment-variable description so its integer parsing and the PYTHONDONTWRITEBYTECODE=0 behavior are accurate; the documentation is done when the wording matches the implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100