| commit | 4a85718212fd032c922ca7d630b2602dd4b29a35 | [log] [tgz] |
|---|---|---|
| author | kfollstad <kfollstad@gmail.com> | Wed Apr 28 16:01:51 2021 -0700 |
| committer | GitHub <noreply@github.com> | Wed Apr 28 19:01:51 2021 -0400 |
| tree | 9f2ba6e6b175c0f2c45de67cd4d01d04d0a90f03 | |
| parent | 15d386185659683fc044ccaa300aa8cd7d49cc1a [diff] |
bpo-43970: Optimize Path.cwd() in pathlib by not instantiating a class unnecessarily (GH-25699)
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 @@ def cwd(cls): """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):