mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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.
This commit is contained in:
parent
9129af6050
commit
8e409cebad
3 changed files with 13 additions and 14 deletions
|
@ -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, '', '', '')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue