[Python-checkins] cpython (3.5): py_getrandom(): use long type for the syscall() result
victor.stinner
python-checkins at python.org
Thu Jun 16 18:02:53 EDT 2016
https://hg.python.org/cpython/rev/193f50babfa4
changeset: 102066:193f50babfa4
branch: 3.5
parent: 102064:41f99ee19804
user: Victor Stinner <victor.stinner at gmail.com>
date: Thu Jun 16 23:53:47 2016 +0200
summary:
py_getrandom(): use long type for the syscall() result
Issue #27278. It should fix a conversion warning.
In practice, the Linux kernel doesn't return more than 32 MB per call to the
getrandom() syscall.
files:
Python/random.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Python/random.c b/Python/random.c
--- a/Python/random.c
+++ b/Python/random.c
@@ -132,7 +132,7 @@
* see https://bugs.python.org/issue26839. To avoid this, use the
* GRND_NONBLOCK flag. */
const int flags = GRND_NONBLOCK;
- int n;
+ long n;
if (!getrandom_works)
return 0;
@@ -143,7 +143,7 @@
to 1024 bytes */
n = Py_MIN(size, 1024);
#else
- n = Py_MIN(size, INT_MAX);
+ n = Py_MIN(size, LONG_MAX);
#endif
errno = 0;
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list