bpo-4928: Document NamedTemporaryFile non-deletion after SIGKILL (#26198)

* bpo-4928 Document NamedTemporaryFile non-deletion after SIGKILL

* 📜🤖 Added by blurb_it.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
This commit is contained in:
Catherine Devlin 2021-05-19 10:21:03 -04:00 committed by GitHub
parent 5d6e463df4
commit b3ab4344d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

View File

@ -87,6 +87,9 @@ The module defines the following user-callable items:
attribute is the underlying true file object. This file-like object can
be used in a :keyword:`with` statement, just like a normal file.
On POSIX (only), a process that is terminated abruptly with SIGKILL
cannot automatically delete any NamedTemporaryFiles it created.
.. audit-event:: tempfile.mkstemp fullpath tempfile.NamedTemporaryFile
.. versionchanged:: 3.8

View File

@ -532,6 +532,10 @@ def NamedTemporaryFile(mode='w+b', buffering=-1, encoding=None,
Returns an object with a file-like interface; the name of the file
is accessible as its 'name' attribute. The file will be automatically
deleted when it is closed unless the 'delete' argument is set to False.
On POSIX, NamedTemporaryFiles cannot be automatically deleted if
the creating process is terminated abruptly with a SIGKILL signal.
Windows can delete the file even in this case.
"""
prefix, suffix, dir, output_type = _sanitize_params(prefix, suffix, dir)

View File

@ -0,0 +1 @@
Documented existing behavior on POSIX: NamedTemporaryFiles are not deleted when creating process is killed with SIGKILL