Skip to content

.gitignore: exclude __pycache__ directories#5838

Merged
rwgk merged 1 commit intopybind:masterfrom
rwgk:gitignore_pycache
Sep 27, 2025
Merged

.gitignore: exclude __pycache__ directories#5838
rwgk merged 1 commit intopybind:masterfrom
rwgk:gitignore_pycache

Conversation

@rwgk
Copy link
Collaborator

@rwgk rwgk commented Sep 15, 2025

Description

Python may leave behind temporary .pyc.* files inside __pycache__ on some filesystems (e.g. WSL2 mounts). Adding __pycache__/ ensures these directories and any leftover files are consistently ignored.

Background: Python writes bytecode to a temp file with an extra suffix before renaming it to .pyc. If the process is interrupted or the filesystem rename isn’t fully atomic, those temp files may remain.

See: https://docs.python.org/3/library/py_compile.html#py_compile.compile

Suggested changelog entry:

  • Placeholder.

Python may leave behind temporary `.pyc.*` files inside `__pycache__`
on some filesystems (e.g. WSL2 mounts). Adding `__pycache__/` ensures
these directories and any leftover files are consistently ignored.

Background: Python writes bytecode to a temp file with an extra suffix
before renaming it to `.pyc`. If the process is interrupted or the
filesystem rename isn’t fully atomic, those temp files may remain.

See: https://docs.python.org/3/library/py_compile.html#py_compile.compile
@rwgk rwgk requested a review from henryiii September 15, 2025 15:52
@rwgk
Copy link
Collaborator Author

rwgk commented Sep 27, 2025

I'll merge this without review: this is an extremely trivial PR.

@rwgk rwgk merged commit 0161da9 into pybind:master Sep 27, 2025
3 checks passed
@rwgk rwgk deleted the gitignore_pycache branch September 27, 2025 20:13
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Sep 27, 2025
@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant