]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43970: Optimize Path.cwd() in pathlib by not instantiating a class unnecessarily...
authorkfollstad <kfollstad@gmail.com>
Wed, 28 Apr 2021 23:01:51 +0000 (16:01 -0700)
committerGitHub <noreply@github.com>
Wed, 28 Apr 2021 23:01:51 +0000 (19:01 -0400)
Lib/pathlib.py

index 073fce82ad57050f3a2174ea9bc2dba44c265641..cf40370c049a3135558fd5f5ed9d0aaa533da314 100644 (file)
@@ -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):