Skip to content

Commit 73d28d5

Browse files
committed
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
1 parent a646c99 commit 73d28d5

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Doc/library/tempfile.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,9 @@ The module defines the following user-callable items:
348348

349349
#. A platform-specific location:
350350

351-
* On Windows, the directories :file:`C:\\TEMP`, :file:`C:\\TMP`,
352-
:file:`\\TEMP`, and :file:`\\TMP`, in that order.
351+
* On Windows, the directories :file:`{USERPROFILE}\\AppData\\Local\\Temp`,
352+
:file:`{SYSTEMROOT}\\Temp`, :file:`c:\\temp`, :file:`c:\\tmp`,
353+
:file:`\\temp`, and :file:`\\tmp`, in that order.
353354

354355
* On all other platforms, the directories :file:`/tmp`, :file:`/var/tmp`, and
355356
:file:`/usr/tmp`, in that order.

0 commit comments

Comments
 (0)