Skip to content

Commit 17386e1

Browse files
committed
fixup! bpo-1154351: add get_current_dir_name() to os module
1 parent d49fdf3 commit 17386e1

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

Doc/library/os.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,10 +1702,10 @@ features:
17021702
.. function:: get_current_dir_name()
17031703

17041704
Return a string representing the current working directory taking into
1705-
consideration the users ``PWD`` environment variable if it exists. This is
1706-
opposed to :func:`getcwd()` which dereferences symlinks in the path. This
1707-
function is identical to :func:`getcwd()` on systems that do **not**
1708-
support the ``PWD`` environment variable.
1705+
consideration the users :envvar:`PWD` environment variable if it exists. This is
1706+
opposed to :func:`getcwd` which dereferences symlinks in the path. This
1707+
function is identical to :func:`getcwd` on systems that do **not**
1708+
support the :envvar:`PWD` environment variable.
17091709

17101710
.. versionadded:: 3.8
17111711

Doc/whatsnew/3.8.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ by right-clicking the button. (Contributed by Tal Einat in :issue:`1529353`.)
141141
The changes above have been backported to 3.7 maintenance releases.
142142

143143

144+
os
145+
--
146+
147+
Added :func:`~os.get_current_dir_name` function.
148+
(Contributed by Braden Groom in :issue:`1154351`.)
149+
144150
os.path
145151
-------
146152

Lib/os.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -660,15 +660,12 @@ def get_current_dir_name():
660660
the *PWD* environment variable.
661661
"""
662662
cwd = getcwd()
663-
664663
if name == 'nt':
665664
return cwd
666-
667665
try:
668666
pwd = environ["PWD"]
669667
except KeyError:
670668
return cwd
671-
672669
if path.samefile(cwd, pwd):
673670
return pwd
674671
return cwd
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
Add get_current_dir_name() to the os module.
2+
Patch by Braden Groom

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy