Skip to content

Commit 54b4f14

Browse files
bpo-38149: Call sys.audit() only once per call for glob.glob(). (GH-18360)
1 parent ab0d892 commit 54b4f14

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Lib/glob.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ def iglob(pathname, *, recursive=False):
3131
If recursive is true, the pattern '**' will match any files and
3232
zero or more directories and subdirectories.
3333
"""
34+
sys.audit("glob.glob", pathname, recursive)
3435
it = _iglob(pathname, recursive, False)
3536
if recursive and _isrecursive(pathname):
3637
s = next(it) # skip empty string
3738
assert not s
3839
return it
3940

4041
def _iglob(pathname, recursive, dironly):
41-
sys.audit("glob.glob", pathname, recursive)
4242
dirname, basename = os.path.split(pathname)
4343
if not has_magic(pathname):
4444
assert not dironly
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:func:`sys.audit` is now called only once per call of :func:`glob.glob` and
2+
:func:`glob.iglob`.

0 commit comments

Comments
 (0)