Christian Heimes <[email protected]> added the comment:
I'm -1 on this feature.
It's both confusing and unnecessary to have this feature in the standard
library. In general we prefer portable functions or expose platform-specific
functions for unique features. The getentropy function is neither portable nor
more useful than the high-level wrapper os.urandom().
If you truly require to access the raw function, then you can easily access the
libc function with a simple C-types wrapper:
>>> from ctypes import cdll, create_string_buffer
>>> libc = cdll.LoadLibrary("libc.so.6")
>>> buf = create_string_buffer(8)
>>> buf.raw
b'\x00\x00\x00\x00\x00\x00\x00\x00'
>>> libc.getentropy(buf, len(buf))
0
>>> buf.raw
b'\xd9\x83`\x8a\x89\xc7\x9eX'
----------
nosy: +christian.heimes
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue33528>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com