Skip to content

Commit

Permalink
bpo-36264: Updates documentation for change to expanduser on Windows (G…
Browse files Browse the repository at this point in the history
  • Loading branch information
zooba committed Mar 12, 2019
1 parent f45813d commit 8ef864d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Doc/library/os.path.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,20 @@ the :mod:`glob` module.)
password directory through the built-in module :mod:`pwd`. An initial ``~user``
is looked up directly in the password directory.

On Windows, :envvar:`HOME` and :envvar:`USERPROFILE` will be used if set,
otherwise a combination of :envvar:`HOMEPATH` and :envvar:`HOMEDRIVE` will be
used. An initial ``~user`` is handled by stripping the last directory component
from the created user path derived above.
On Windows, :envvar:`USERPROFILE` will be used if set, otherwise a combination
of :envvar:`HOMEPATH` and :envvar:`HOMEDRIVE` will be used. An initial
``~user`` is handled by stripping the last directory component from the created
user path derived above.

If the expansion fails or if the path does not begin with a tilde, the path is
returned unchanged.

.. versionchanged:: 3.6
Accepts a :term:`path-like object`.

.. versionchanged:: 3.8
No longer uses :envvar:`HOME` on Windows.

.. index::
single: $ (dollar); environment variables expansion
single: % (percent); environment variables expansion (Windows)
Expand Down
8 changes: 8 additions & 0 deletions Doc/whatsnew/3.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ now return ``False`` instead of raising :exc:`ValueError` or its subclasses
characters or bytes unrepresentable at the OS level.
(Contributed by Serhiy Storchaka in :issue:`33721`.)

:func:`~os.path.expanduser` on Windows now prefers the :envvar:`USERPROFILE`
environment variable and does not use :envvar:`HOME`, which is not normally set
for regular user accounts.


ncurses
-------
Expand Down Expand Up @@ -672,6 +676,10 @@ Changes in the Python API
:exc:`dbm.gnu.error` or :exc:`dbm.ndbm.error`) instead of :exc:`KeyError`.
(Contributed by Xiang Zhang in :issue:`33106`.)

* :func:`~os.path.expanduser` on Windows now prefers the :envvar:`USERPROFILE`
environment variable and does not use :envvar:`HOME`, which is not normally
set for regular user accounts.


CPython bytecode changes
------------------------
Expand Down

0 comments on commit 8ef864d

Please sign in to comment.