Skip to content

os urandom does not document CCRandomGenerateBytes #116245

@RappelBerryPi

Description

@RappelBerryPi

Documentation

The documentation for os.urandom clearly states that for Linux systems getrandom() is used when available (and then depending on python release and Linux version the behavior changes).

The documentation also clearly states that for Windows os.urandom uses BCryptGenRandom (which was previously CryptGenRandom before release 3.11).

The documentation then states that on a "Unix-like system" that reads to /dev/urandom are done.

However macOS is not mentioned (which could technically be covered by the "Unix-like system" and is often misinterpreted that way).

The /mimalloc/prim/unix/prim.c file (around lines 730-760) define macOS functionality using CCRandomGenerateBytes and then falling back to arc4random_buf.

The above functionality should be documented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions