diff options
-rw-r--r-- | Lib/pathlib.py | 3 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2022-01-09-15-04-56.bpo-46316.AMTyd0.rst | 1 |
2 files changed, 1 insertions, 3 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py index f1a3317..04b321b 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -1013,9 +1013,6 @@ class Path(PurePath): result for the special paths '.' and '..'. """ for name in self._accessor.listdir(self): - if name in {'.', '..'}: - # Yielding a path object for these makes little sense - continue yield self._make_child_relpath(name) def glob(self, pattern): diff --git a/Misc/NEWS.d/next/Library/2022-01-09-15-04-56.bpo-46316.AMTyd0.rst b/Misc/NEWS.d/next/Library/2022-01-09-15-04-56.bpo-46316.AMTyd0.rst new file mode 100644 index 0000000..09acb77 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-01-09-15-04-56.bpo-46316.AMTyd0.rst @@ -0,0 +1 @@ +Optimize :meth:`pathlib.Path.iterdir` by removing an unnecessary check for special entries. |