-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Description
Documentation
In the documentation for https://docs.python.org/3/library/tempfile.html#tempfile.mkstemp
It states The file descriptor is not inherited by child processes.
However, taking a look through https://github.com/python/cpython/blob/main/Lib/tempfile.py there are no indicators of any registering of any close-on-fork or close-on-exec functions or anything exotic to ensure that child processes cannot inherit this file descriptor. The file descriptor is also created in a very normal manner via fd = _os.open(file, flags, 0o600). Additionally, there is empirical evidence this is not true, as we are successfully using the inherited file descriptor in child processes in our codebase (DESI-UR/VAST), so this detail in the documentation appears to be at minimum, not the whole story, and possibly just incorrect.
Perhaps there is some case where it is true (maybe on Windows using multiprocessing 'spawn') or something along those lines?
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status
Status