From 8e409cebad42032bb7d0f2cadd8b1e36081d98af Mon Sep 17 00:00:00 2001 From: Eric W Date: Fri, 30 Oct 2020 05:56:28 +0100 Subject: 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. --- Lib/test/test_tempfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Lib/test') diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py index 8ace883d74..77d710efaf 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, '', '', '') -- cgit v1.2.1