diff options
-rw-r--r-- | Doc/library/tempfile.rst | 3 | ||||
-rw-r--r-- | Lib/tempfile.py | 4 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2021-05-17-21-05-06.bpo-4928.Ot2yjO.rst | 1 |
3 files changed, 8 insertions, 0 deletions
diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst index 2970252..49396b5 100644 --- a/Doc/library/tempfile.rst +++ b/Doc/library/tempfile.rst @@ -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 diff --git a/Lib/tempfile.py b/Lib/tempfile.py index efcf7a7..8570c3b 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -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) diff --git a/Misc/NEWS.d/next/Library/2021-05-17-21-05-06.bpo-4928.Ot2yjO.rst b/Misc/NEWS.d/next/Library/2021-05-17-21-05-06.bpo-4928.Ot2yjO.rst new file mode 100644 index 0000000..359f801 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-05-17-21-05-06.bpo-4928.Ot2yjO.rst @@ -0,0 +1 @@ +Documented existing behavior on POSIX: NamedTemporaryFiles are not deleted when creating process is killed with SIGKILL
\ No newline at end of file |