Skip to content

Commit 1540584

Browse files
gh-71450: Document that Tcl sets the HOME variable on Windows (GH-152568)
Also fix the ntpath.expanduser() docstring, which no longer uses $HOME. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7aae0e5 commit 1540584

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

Doc/library/tkinter.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3394,6 +3394,14 @@ Toplevel widgets
33943394
profile files is the :envvar:`HOME` environment variable or, if that
33953395
isn't defined, then :data:`os.curdir`.
33963396

3397+
.. note::
3398+
3399+
On Windows, creating a Tcl interpreter (by instantiating :class:`Tk` or
3400+
calling :func:`Tcl`) sets the :envvar:`HOME` environment variable for
3401+
the process, if it is not already set, to ``%HOMEDRIVE%%HOMEPATH%`` (or
3402+
:envvar:`USERPROFILE`, or ``c:\``). This is done by Tcl and can affect
3403+
other code that reads :envvar:`HOME`.
3404+
33973405
.. attribute:: tk
33983406

33993407
The Tk application object created by instantiating :class:`Tk`. This

Lib/ntpath.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ def _isreservedname(name):
345345
def expanduser(path):
346346
"""Expand ~ and ~user constructs.
347347
348-
If user or $HOME is unknown, do nothing."""
348+
If user or home directory is unknown, do nothing."""
349349
path = os.fspath(path)
350350
if isinstance(path, bytes):
351351
seps = b'\\/'

0 commit comments

Comments
 (0)