summaryrefslogtreecommitdiffstats
path: root/Lib/tempfile.py
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2020-11-01 11:02:03 (GMT)
committerGitHub <noreply@github.com>2020-11-01 11:02:03 (GMT)
commitd2810054c7ee1b4ce925fc520224b595b53bf4b4 (patch)
treedac8981d72d176507e62e2df0b5d5694f46e5eaa /Lib/tempfile.py
parent2165cea548f961b308050f30d1f042a377651d44 (diff)
downloadcpython-d2810054c7ee1b4ce925fc520224b595b53bf4b4.zip
cpython-d2810054c7ee1b4ce925fc520224b595b53bf4b4.tar.gz
cpython-d2810054c7ee1b4ce925fc520224b595b53bf4b4.tar.bz2
tempfile: Use random.choises() instead of choise() (GH-23068)
Diffstat (limited to 'Lib/tempfile.py')
-rw-r--r--Lib/tempfile.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index 770f72c..c3fe61a 100644
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -143,10 +143,7 @@ class _RandomNameSequence:
return self
def __next__(self):
- c = self.characters
- choose = self.rng.choice
- letters = [choose(c) for dummy in range(8)]
- return ''.join(letters)
+ return ''.join(self.rng.choices(self.characters, k=8))
def _candidate_tempdir_list():
"""Generate a list of candidate temporary directories which