From abb4ca771a4efb733886aca56d5d87ecc2f2891b Mon Sep 17 00:00:00 2001 From: Facundo Batista Date: Sun, 15 Feb 2026 11:53:18 -0300 Subject: [PATCH 1/4] Added missing explanations for some parameters in glob and iglob. --- Lib/glob.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Lib/glob.py b/Lib/glob.py index c2f8ce279aba64..1d1d87e2216316 100644 --- a/Lib/glob.py +++ b/Lib/glob.py @@ -25,6 +25,14 @@ def glob(pathname, *, root_dir=None, dir_fd=None, recursive=False, The order of the returned list is undefined. Sort it if you need a particular order. + If root_dir is not None, it should be a path-like object specifying the + root directory for searching. It has the same effect as changing the + current directory before calling it. If pathname is relative, the + result will contain paths relative to root_dir. + + If dir_fd is not None, it should be a file descriptor referring to a + directory, and paths will then be relative to that directory. + If `include_hidden` is true, the patterns '*', '?', '**' will match hidden directories. @@ -46,6 +54,17 @@ def iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False, The order of the returned paths is undefined. Sort them if you need a particular order. + If root_dir is not None, it should be a path-like object specifying the + root directory for searching. It has the same effect as changing the + current directory before calling it. If pathname is relative, the + result will contain paths relative to root_dir. + + If dir_fd is not None, it should be a file descriptor referring to a + directory, and paths will then be relative to that directory. + + If `include_hidden` is true, the patterns '*', '?', '**' will match hidden + directories. + If recursive is true, the pattern '**' will match any files and zero or more directories and subdirectories. """ From 7c16dc8cbdf07666de6b575f2572d8fede8a4896 Mon Sep 17 00:00:00 2001 From: Facundo Batista Date: Sun, 15 Feb 2026 12:02:37 -0300 Subject: [PATCH 2/4] News entry. --- .../next/Library/2026-02-15-12-02-20.gh-issue-144835.w_oS_J.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2026-02-15-12-02-20.gh-issue-144835.w_oS_J.rst diff --git a/Misc/NEWS.d/next/Library/2026-02-15-12-02-20.gh-issue-144835.w_oS_J.rst b/Misc/NEWS.d/next/Library/2026-02-15-12-02-20.gh-issue-144835.w_oS_J.rst new file mode 100644 index 00000000000000..9c3d5fa037a386 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-02-15-12-02-20.gh-issue-144835.w_oS_J.rst @@ -0,0 +1,2 @@ +Added missing explanations for some parameters in `glob.glob` and +`glob.iglob`. From 917fc0066f8febbd672e10aa9e52469e38f97219 Mon Sep 17 00:00:00 2001 From: Facundo Batista Date: Sun, 15 Feb 2026 12:16:54 -0300 Subject: [PATCH 3/4] Added proper 'func' indication in News file. --- .../Library/2026-02-15-12-02-20.gh-issue-144835.w_oS_J.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS.d/next/Library/2026-02-15-12-02-20.gh-issue-144835.w_oS_J.rst b/Misc/NEWS.d/next/Library/2026-02-15-12-02-20.gh-issue-144835.w_oS_J.rst index 9c3d5fa037a386..9d603b51c48a93 100644 --- a/Misc/NEWS.d/next/Library/2026-02-15-12-02-20.gh-issue-144835.w_oS_J.rst +++ b/Misc/NEWS.d/next/Library/2026-02-15-12-02-20.gh-issue-144835.w_oS_J.rst @@ -1,2 +1,2 @@ -Added missing explanations for some parameters in `glob.glob` and -`glob.iglob`. +Added missing explanations for some parameters in :func:`glob.glob` and +:func:`glob.iglob`. From b2cb604f3bf0ec7d5869aa9fc54dc0782910f35e Mon Sep 17 00:00:00 2001 From: Facundo Batista Date: Wed, 18 Feb 2026 11:17:37 -0300 Subject: [PATCH 4/4] Consistent use of backticks. --- Lib/glob.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Lib/glob.py b/Lib/glob.py index 1d1d87e2216316..6b118141f6c48e 100644 --- a/Lib/glob.py +++ b/Lib/glob.py @@ -15,7 +15,7 @@ def glob(pathname, *, root_dir=None, dir_fd=None, recursive=False, include_hidden=False): - """Return a list of paths matching a pathname pattern. + """Return a list of paths matching a `pathname` pattern. The pattern may contain simple shell-style wildcards a la fnmatch. Unlike fnmatch, filenames starting with a @@ -25,12 +25,12 @@ def glob(pathname, *, root_dir=None, dir_fd=None, recursive=False, The order of the returned list is undefined. Sort it if you need a particular order. - If root_dir is not None, it should be a path-like object specifying the + If `root_dir` is not None, it should be a path-like object specifying the root directory for searching. It has the same effect as changing the current directory before calling it. If pathname is relative, the - result will contain paths relative to root_dir. + result will contain paths relative to `root_dir`. - If dir_fd is not None, it should be a file descriptor referring to a + If `dir_fd` is not None, it should be a file descriptor referring to a directory, and paths will then be relative to that directory. If `include_hidden` is true, the patterns '*', '?', '**' will match hidden @@ -44,7 +44,7 @@ def glob(pathname, *, root_dir=None, dir_fd=None, recursive=False, def iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False, include_hidden=False): - """Return an iterator which yields the paths matching a pathname pattern. + """Return an iterator which yields the paths matching a `pathname` pattern. The pattern may contain simple shell-style wildcards a la fnmatch. However, unlike fnmatch, filenames starting with a @@ -54,18 +54,18 @@ def iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False, The order of the returned paths is undefined. Sort them if you need a particular order. - If root_dir is not None, it should be a path-like object specifying the + If `root_dir` is not None, it should be a path-like object specifying the root directory for searching. It has the same effect as changing the current directory before calling it. If pathname is relative, the - result will contain paths relative to root_dir. + result will contain paths relative to `root_dir`. - If dir_fd is not None, it should be a file descriptor referring to a + If `dir_fd` is not None, it should be a file descriptor referring to a directory, and paths will then be relative to that directory. If `include_hidden` is true, the patterns '*', '?', '**' will match hidden directories. - If recursive is true, the pattern '**' will match any files and + If `recursive` is true, the pattern '**' will match any files and zero or more directories and subdirectories. """ sys.audit("glob.glob", pathname, recursive)