diff options
author | Eric W <robo-eric@gmx.de> | 2020-10-30 04:56:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-30 04:56:28 (GMT) |
commit | 8e409cebad42032bb7d0f2cadd8b1e36081d98af (patch) | |
tree | 4347dffac5a388a69782692bfa63075bf8607cdf /Lib/test/test_tempfile.py | |
parent | 9129af6050b747f288baa9d4e7d43031647ed222 (diff) | |
download | cpython-8e409cebad42032bb7d0f2cadd8b1e36081d98af.zip cpython-8e409cebad42032bb7d0f2cadd8b1e36081d98af.tar.gz cpython-8e409cebad42032bb7d0f2cadd8b1e36081d98af.tar.bz2 |
bpo-42160: tempfile: Reduce overhead of pid check. (GH-22997)
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.
Diffstat (limited to 'Lib/test/test_tempfile.py')
-rw-r--r-- | Lib/test/test_tempfile.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py index 8ace883..77d710e 100644 --- a/Lib/test/test_tempfile.py +++ b/Lib/test/test_tempfile.py @@ -153,8 +153,8 @@ class TestRandomNameSequence(BaseTestCase): self.r = tempfile._RandomNameSequence() super().setUp() - def test_get_six_char_str(self): - # _RandomNameSequence returns a six-character string + def test_get_eight_char_str(self): + # _RandomNameSequence returns a eight-character string s = next(self.r) self.nameCheck(s, '', '', '') |