]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-38149: Call sys.audit() only once per call for glob.glob(). (GH-18360)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 6 Feb 2020 08:45:18 +0000 (00:45 -0800)
committerGitHub <noreply@github.com>
Thu, 6 Feb 2020 08:45:18 +0000 (00:45 -0800)
(cherry picked from commit 54b4f14712b9350f11c983f1c8ac47a3716958a7)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/glob.py
Misc/NEWS.d/next/Library/2020-02-05-11-24-16.bpo-38149.GWsjHE.rst [new file with mode: 0644]

index 0b3fcc6bbb9af3b63f8c2a5577f6301ea9c65b60..0dd2f8be6610945c27abc4bab25c06fcf58dac60 100644 (file)
@@ -31,6 +31,7 @@ def iglob(pathname, *, recursive=False):
     If recursive is true, the pattern '**' will match any files and
     zero or more directories and subdirectories.
     """
+    sys.audit("glob.glob", pathname, recursive)
     it = _iglob(pathname, recursive, False)
     if recursive and _isrecursive(pathname):
         s = next(it)  # skip empty string
@@ -38,7 +39,6 @@ def iglob(pathname, *, recursive=False):
     return it
 
 def _iglob(pathname, recursive, dironly):
-    sys.audit("glob.glob", pathname, recursive)
     dirname, basename = os.path.split(pathname)
     if not has_magic(pathname):
         assert not dironly
diff --git a/Misc/NEWS.d/next/Library/2020-02-05-11-24-16.bpo-38149.GWsjHE.rst b/Misc/NEWS.d/next/Library/2020-02-05-11-24-16.bpo-38149.GWsjHE.rst
new file mode 100644 (file)
index 0000000..b4ec60b
--- /dev/null
@@ -0,0 +1,2 @@
+:func:`sys.audit` is now called only once per call of :func:`glob.glob` and
+:func:`glob.iglob`.