From 73d28d534e651290c8072562a9cef17bf862c4a8 Mon Sep 17 00:00:00 2001 From: Diwak4r Date: Sat, 1 Aug 2026 19:06:33 +0545 Subject: [PATCH] docs(tempfile): correct Windows temp directory search order The existing docs claim gettempdir() searches C:\TEMP, C:\TMP, \TEMP, \TMP on Windows, but the actual implementation (Lib/tempfile.py lines 192-194) first checks TMPDIR, TEMP, and TMP environment variables. On Windows, TEMP and TMP typically point to: - %USERPROFILE%\AppData\Local\Temp (user temp) - %SYSTEMROOT%\Temp (system temp) Update the docs to reflect the actual search order: env vars first, then hardcoded fallback paths. Fixes #151138 --- Doc/library/tempfile.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst index 9b89cb92594ea6..76918e886e45b0 100644 --- a/Doc/library/tempfile.rst +++ b/Doc/library/tempfile.rst @@ -348,8 +348,9 @@ The module defines the following user-callable items: #. A platform-specific location: - * On Windows, the directories :file:`C:\\TEMP`, :file:`C:\\TMP`, - :file:`\\TEMP`, and :file:`\\TMP`, in that order. + * On Windows, the directories :file:`{USERPROFILE}\\AppData\\Local\\Temp`, + :file:`{SYSTEMROOT}\\Temp`, :file:`c:\\temp`, :file:`c:\\tmp`, + :file:`\\temp`, and :file:`\\tmp`, in that order. * On all other platforms, the directories :file:`/tmp`, :file:`/var/tmp`, and :file:`/usr/tmp`, in that order.