Skip to content

Commit 11c3a40

Browse files
miss-islingtonserhiy-storchakaclaude
authored
[3.15] gh-71450: Document that Tcl sets the HOME variable on Windows (GH-152568) (GH-152574)
Also fix the ntpath.expanduser() docstring, which no longer uses $HOME. (cherry picked from commit 1540584) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 00a4304 commit 11c3a40

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
@@ -3298,6 +3298,14 @@ Toplevel widgets
32983298
profile files is the :envvar:`HOME` environment variable or, if that
32993299
isn't defined, then :data:`os.curdir`.
33003300

3301+
.. note::
3302+
3303+
On Windows, creating a Tcl interpreter (by instantiating :class:`Tk` or
3304+
calling :func:`Tcl`) sets the :envvar:`HOME` environment variable for
3305+
the process, if it is not already set, to ``%HOMEDRIVE%%HOMEPATH%`` (or
3306+
:envvar:`USERPROFILE`, or ``c:\``). This is done by Tcl and can affect
3307+
other code that reads :envvar:`HOME`.
3308+
33013309
.. attribute:: tk
33023310

33033311
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)