File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -172,17 +172,20 @@ the :mod:`glob` module.)
172172 password directory through the built-in module :mod: `pwd `. An initial ``~user ``
173173 is looked up directly in the password directory.
174174
175- On Windows, :envvar: `HOME ` and :envvar: ` USERPROFILE ` will be used if set,
176- otherwise a combination of :envvar: `HOMEPATH ` and :envvar: `HOMEDRIVE ` will be
177- used. An initial ``~user `` is handled by stripping the last directory component
178- from the created user path derived above.
175+ On Windows, :envvar: `USERPROFILE ` will be used if set, otherwise a combination
176+ of :envvar: `HOMEPATH ` and :envvar: `HOMEDRIVE ` will be used. An initial
177+ ``~user `` is handled by stripping the last directory component from the created
178+ user path derived above.
179179
180180 If the expansion fails or if the path does not begin with a tilde, the path is
181181 returned unchanged.
182182
183183 .. versionchanged :: 3.6
184184 Accepts a :term: `path-like object `.
185185
186+ .. versionchanged :: 3.8
187+ No longer uses :envvar: `HOME ` on Windows.
188+
186189.. index ::
187190 single: $ (dollar); environment variables expansion
188191 single: % (percent); environment variables expansion (Windows)
Original file line number Diff line number Diff line change @@ -236,6 +236,10 @@ now return ``False`` instead of raising :exc:`ValueError` or its subclasses
236236characters or bytes unrepresentable at the OS level.
237237(Contributed by Serhiy Storchaka in :issue: `33721 `.)
238238
239+ :func: `~os.path.expanduser ` on Windows now prefers the :envvar: `USERPROFILE `
240+ environment variable and does not use :envvar: `HOME `, which is not normally set
241+ for regular user accounts.
242+
239243
240244ncurses
241245-------
@@ -672,6 +676,10 @@ Changes in the Python API
672676 :exc: `dbm.gnu.error ` or :exc: `dbm.ndbm.error `) instead of :exc: `KeyError `.
673677 (Contributed by Xiang Zhang in :issue: `33106 `.)
674678
679+ * :func: `~os.path.expanduser ` on Windows now prefers the :envvar: `USERPROFILE `
680+ environment variable and does not use :envvar: `HOME `, which is not normally
681+ set for regular user accounts.
682+
675683
676684CPython bytecode changes
677685------------------------
You can’t perform that action at this time.
0 commit comments