Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 66aab0c commit c7cd12dCopy full SHA for c7cd12d
1 file changed
Python/random.c
@@ -166,17 +166,17 @@ dev_urandom_noraise(unsigned char *buffer, Py_ssize_t size)
166
167
assert (0 < size);
168
169
- fd = _Py_open_noraise("/dev/urandom", O_RDONLY);
170
- if (fd < 0)
171
- Py_FatalError("Failed to open /dev/urandom");
172
-
173
#ifdef HAVE_GETRANDOM_SYSCALL
174
if (py_getrandom(buffer, size, 0) == 1)
175
return;
176
/* getrandom() is not supported by the running kernel, fall back
177
* on reading /dev/urandom */
178
#endif
179
+ fd = _Py_open_noraise("/dev/urandom", O_RDONLY);
+ if (fd < 0)
+ Py_FatalError("Failed to open /dev/urandom");
+
180
while (0 < size)
181
{
182
do {
0 commit comments