From 4a85718212fd032c922ca7d630b2602dd4b29a35 Mon Sep 17 00:00:00 2001 From: kfollstad Date: Wed, 28 Apr 2021 16:01:51 -0700 Subject: bpo-43970: Optimize Path.cwd() in pathlib by not instantiating a class unnecessarily (GH-25699) --- Lib/pathlib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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): -- cgit v0.12