bpo-38149: Call sys.audit() only once per call for glob.glob(). (GH-18360)
diff --git a/Lib/glob.py b/Lib/glob.py
index 0b3fcc6..0dd2f8b 100644
--- a/Lib/glob.py
+++ b/Lib/glob.py
@@ -31,6 +31,7 @@
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 @@
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