From 7bc6786694c10eb353481b51ee2256509930b736 Mon Sep 17 00:00:00 2001 From: AK Date: Fri, 30 Apr 2021 19:58:02 -0400 Subject: [PATCH 1/2] Updated glob.iglob doc with details on memory use --- Doc/library/glob.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Doc/library/glob.rst b/Doc/library/glob.rst index 215f60d328c76a5..e09555b9afdd92b 100644 --- a/Doc/library/glob.rst +++ b/Doc/library/glob.rst @@ -80,8 +80,12 @@ For example, ``'[?]'`` matches the character ``'?'``. .. function:: iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False) - Return an :term:`iterator` which yields the same values as :func:`glob` - without actually storing them all simultaneously. + Return an :term:`iterator` which yields the same values as :func:`glob.glob` without + actually storing them all simultaneously. Internally, :func:`iglob` uses + :func:`os.listdir` which may result in large amount of memory being consumed if a + single directory contains a large number of files. Unlike :func:`glob.glob`, the case + with large number of subdirectories but with small number of files per each + subdirectory, should not result in large amount of memory consumption. .. audit-event:: glob.glob pathname,recursive glob.iglob .. audit-event:: glob.glob/2 pathname,recursive,root_dir,dir_fd glob.iglob From 0854ccdbd3c4619f5199036e239382c055335f79 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sat, 1 May 2021 00:08:05 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Documentation/2021-05-01-00-08-04.bpo-22167.2i15sR.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Documentation/2021-05-01-00-08-04.bpo-22167.2i15sR.rst diff --git a/Misc/NEWS.d/next/Documentation/2021-05-01-00-08-04.bpo-22167.2i15sR.rst b/Misc/NEWS.d/next/Documentation/2021-05-01-00-08-04.bpo-22167.2i15sR.rst new file mode 100644 index 000000000000000..936825687236972 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2021-05-01-00-08-04.bpo-22167.2i15sR.rst @@ -0,0 +1 @@ +:func:`glob.iglob` documentation updated with details on memory use. \ No newline at end of file