Fix tempfile to not use random.Random

This commit is contained in:
coolreader18
2019-11-13 22:08:45 -06:00
parent a3b435c0d3
commit 458c68263d
3 changed files with 9 additions and 4 deletions

View File

@@ -14,7 +14,7 @@ import itertools
import os
import socket
import subprocess
# import tempfile
import tempfile
import warnings

View File

@@ -15,7 +15,7 @@ import sys
import socket
import struct
import time
#import tempfile
import tempfile
import itertools
import _multiprocessing

9
Lib/tempfile.py vendored
View File

@@ -42,7 +42,8 @@ import io as _io
import os as _os
import shutil as _shutil
import errno as _errno
from random import Random as _Random
# XXX RustPython TODO: _random
#from random import Random as _Random
import weakref as _weakref
try:
@@ -156,7 +157,11 @@ class _RandomNameSequence:
def __next__(self):
c = self.characters
choose = self.rng.choice
def choose(s):
import math, random
return s[math.floor(random.random() * len(s))]
# XXX RustPython TODO: proper random impl
# choose = self.rng.choose
letters = [choose(c) for dummy in range(8)]
return ''.join(letters)