From: kfollstad Date: Wed, 28 Apr 2021 23:01:51 +0000 (-0700) Subject: bpo-43970: Optimize Path.cwd() in pathlib by not instantiating a class unnecessarily... X-Git-Tag: v3.10.0b1~110 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4a85718212fd032c922ca7d630b2602dd4b29a35;p=thirdparty%2FPython%2Fcpython.git 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 073fce82ad57..cf40370c049a 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):