Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-42160: reduce overhead in tempfile #22997

Merged
merged 9 commits into from Oct 30, 2020
Merged

Conversation

Deric-W
Copy link
Contributor

@Deric-W Deric-W commented Oct 27, 2020

  • replace pid check in _RandomNameSequence with os.register_at_fork
  • add variants property to allow replacing TMP_MAX with a calculated value
  • fix small typo in test_tempfile

https://bugs.python.org/issue42160

Deric-W added 2 commits Oct 26, 2020
The _RandomSequence class in tempfile used to check the current pid every time its rng property was used.
This commit replaces this code with os.register_at_fork to reduce the overhead.
Lib/tempfile.py Outdated Show resolved Hide resolved
Lib/tempfile.py Outdated Show resolved Hide resolved
@methane methane merged commit 8e409ce into python:master Oct 30, 2020
3 checks passed
@Deric-W Deric-W deleted the tempfile-overhead branch Oct 30, 2020
methane added a commit that referenced this pull request Oct 31, 2020
methane added a commit that referenced this pull request Oct 31, 2020
`_RandomNameSequence` is not true singleton so using `os.register_at_fork` doesn't make sense unlike `random._inst`.

This reverts commit 8e409ce.
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
The _RandomSequence class in tempfile used to check the current pid every time its rng property was used.
This commit replaces this code with `os.register_at_fork` to reduce the overhead.
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
…22997)"

`_RandomNameSequence` is not true singleton so using `os.register_at_fork` doesn't make sense unlike `random._inst`.

This reverts commit 8e409ce.
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.

None yet

4 participants