Skip to content

Commit 5243b9e

Browse files
Use os.urandom().
1 parent 7363c99 commit 5243b9e

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

Lib/asyncio/windows_utils.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import _winapi
99
import msvcrt
1010
import os
11-
import random
1211
import subprocess
1312
import warnings
1413

@@ -51,7 +50,7 @@ def pipe(*, duplex=False, overlapped=(True, True), bufsize=BUFSIZE):
5150
h1 = h2 = None
5251
try:
5352
while True:
54-
address = r'\\.\pipe\python-pipe-' + random.randbytes(8).hex()
53+
address = r'\\.\pipe\python-pipe-' + os.urandom(8).hex()
5554
try:
5655
h1 = _winapi.CreateNamedPipe(
5756
address, openmode, _winapi.PIPE_WAIT,

Lib/multiprocessing/connection.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import errno
1313
import io
1414
import os
15-
import random
1615
import sys
1716
import socket
1817
import struct
@@ -76,7 +75,7 @@ def arbitrary_address(family):
7675
elif family == 'AF_UNIX':
7776
return tempfile.mktemp(prefix='sock-', dir=util.get_temp_dir())
7877
elif family == 'AF_PIPE':
79-
return r'\\.\pipe\pyc-' + random.randbytes(8).hex()
78+
return r'\\.\pipe\pyc-' + os.urandom(8).hex()
8079
else:
8180
raise ValueError('unrecognized family')
8281

0 commit comments

Comments
 (0)