[issue27778] PEP 524: Add os.getrandom()

Christian Heimes report at bugs.python.org
Wed Sep 14 03:41:05 EDT 2016


Christian Heimes added the comment:

Oh sorry, I looked in the wrong location and missed it.

* if (PyErr_CheckSignals() < 0) {return NULL;} does not free buffer with PyMem_Free(buffer);

* The function allocates memory once with PyMem_Malloc() and later a second time with PyBytes_FromStringAndSize(buffer, n). You can avoid the first allocation and a memcpy() with PyBytes_FromStringAndSize(NULL, n) and PyBytes_AS_STRING().

* The syscall can also raise EPERM as reported by a user on QNAP. IIRC a seccomp policy caused EPERM.

----------
versions: +Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27778>
_______________________________________


More information about the Python-bugs-list mailing list