Skip to content

gh-143134: Docs: clarify PYTHONDONTWRITEBYTECODE behavior#143144

Open
Javed-Shekh777 wants to merge 7 commits into
python:mainfrom
Javed-Shekh777:docs-fix-pythondontwritebytecode
Open

gh-143134: Docs: clarify PYTHONDONTWRITEBYTECODE behavior#143144
Javed-Shekh777 wants to merge 7 commits into
python:mainfrom
Javed-Shekh777:docs-fix-pythondontwritebytecode

Conversation

@Javed-Shekh777

@Javed-Shekh777 Javed-Shekh777 commented Dec 24, 2025

Copy link
Copy Markdown

This PR fixes incorrect documentation for PYTHONDONTWRITEBYTECODE.

The documentation previously stated that setting the variable to any
non-empty string disables writing .pyc files. In reality, the value is
parsed as an integer flag: non-zero values disable bytecode generation,
while setting it to 0 does not.

This change updates the documentation to accurately reflect the actual
runtime behavior, keeping it consistent with how the variable is handled
in Python/initconfig.c.

Closes #143134


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

@python-cla-bot

python-cla-bot Bot commented Dec 24, 2025

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

Comment thread Doc/using/cmdline.rst Outdated
@StanFromIreland StanFromIreland changed the title Docs: clarify PYTHONDONTWRITEBYTECODE behavior gh-143134: Docs: clarify PYTHONDONTWRITEBYTECODE behavior Dec 24, 2025
@Javed-Shekh777 Javed-Shekh777 changed the title gh-143134: Docs: clarify PYTHONDONTWRITEBYTECODE behavior Docs: clarify PYTHONDONTWRITEBYTECODE behavior (gh-143134) Dec 24, 2025
@StanFromIreland

Copy link
Copy Markdown
Member

Please revert the title format change.

@Javed-Shekh777 Javed-Shekh777 changed the title Docs: clarify PYTHONDONTWRITEBYTECODE behavior (gh-143134) Docs: clarify PYTHONDONTWRITEBYTECODE behavior Dec 24, 2025
@StanFromIreland StanFromIreland changed the title Docs: clarify PYTHONDONTWRITEBYTECODE behavior gh-143134: Docs: clarify PYTHONDONTWRITEBYTECODE behavior Dec 24, 2025

@StanFromIreland StanFromIreland left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, see Victors list and Serhiy's comment on the issue, there are more to fix.

Comment thread Doc/using/cmdline.rst
Comment on lines +884 to +885
``.pyc`` files on the import of source modules. Setting it to ``0`` does
not disable bytecode writing. This is equivalent to specifying the

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add "Setting it to 0 does not disable bytecode writing," it is already implied by the first sentence ("other than 0"), no?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I suggest to remove this sentence.

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review docs Documentation in the Doc dir skip news stale Stale PR or inactive for long period of time.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

PYTHONDONTWRITEBYTECODE documentation is incorrect

3 participants