changeset: 102066:193f50babfa4 branch: 3.5 parent: 102064:41f99ee19804 user: Victor Stinner date: Thu Jun 16 23:53:47 2016 +0200 files: Python/random.c description: 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. diff -r 41f99ee19804 -r 193f50babfa4 Python/random.c --- a/Python/random.c Thu Jun 16 22:08:46 2016 +0300 +++ b/Python/random.c Thu Jun 16 23:53:47 2016 +0200 @@ -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;