summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkfollstad <kfollstad@gmail.com>2021-04-28 23:01:51 (GMT)
committerGitHub <noreply@github.com>2021-04-28 23:01:51 (GMT)
commit4a85718212fd032c922ca7d630b2602dd4b29a35 (patch)
tree9f2ba6e6b175c0f2c45de67cd4d01d04d0a90f03
parent15d386185659683fc044ccaa300aa8cd7d49cc1a (diff)
downloadcpython-4a85718212fd032c922ca7d630b2602dd4b29a35.zip
cpython-4a85718212fd032c922ca7d630b2602dd4b29a35.tar.gz
cpython-4a85718212fd032c922ca7d630b2602dd4b29a35.tar.bz2
bpo-43970: Optimize Path.cwd() in pathlib by not instantiating a class unnecessarily (GH-25699)
-rw-r--r--Lib/pathlib.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index 073fce8..cf40370 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -978,7 +978,7 @@ class Path(PurePath):
"""Return a new path pointing to the current working directory
(as returned by os.getcwd()).
"""
- return cls(cls()._accessor.getcwd())
+ return cls(cls._accessor.getcwd())
@classmethod
def home(cls):