]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-71450: Document that Tcl sets the HOME variable on Windows (GH-152568)
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 29 Jun 2026 09:35:24 +0000 (12:35 +0300)
committerGitHub <noreply@github.com>
Mon, 29 Jun 2026 09:35:24 +0000 (09:35 +0000)
Also fix the ntpath.expanduser() docstring, which no longer uses $HOME.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Doc/library/tkinter.rst
Lib/ntpath.py

index 64ef07ede6fbda9fbc091f443fd72c844eb9618d..cf342d74bc433e5cf1d4e7553b02667df0662f3a 100644 (file)
@@ -3394,6 +3394,14 @@ Toplevel widgets
    profile files is the :envvar:`HOME` environment variable or, if that
    isn't defined, then :data:`os.curdir`.
 
+   .. note::
+
+      On Windows, creating a Tcl interpreter (by instantiating :class:`Tk` or
+      calling :func:`Tcl`) sets the :envvar:`HOME` environment variable for
+      the process, if it is not already set, to ``%HOMEDRIVE%%HOMEPATH%`` (or
+      :envvar:`USERPROFILE`, or ``c:\``).  This is done by Tcl and can affect
+      other code that reads :envvar:`HOME`.
+
    .. attribute:: tk
 
       The Tk application object created by instantiating :class:`Tk`.  This
index 811e796f7766e94967a50d89e4c4f7c307bc6d6a..b3c23f0abc2d8893d6bc3b3563253c6eb406a32b 100644 (file)
@@ -345,7 +345,7 @@ def _isreservedname(name):
 def expanduser(path):
     """Expand ~ and ~user constructs.
 
-    If user or $HOME is unknown, do nothing."""
+    If user or home directory is unknown, do nothing."""
     path = os.fspath(path)
     if isinstance(path, bytes):
         seps = b'\\/'