bpo-38149: Call sys.audit() only once per call for glob.glob(). (GH-18360)

This commit is contained in:
Serhiy Storchaka 2020-02-06 10:26:37 +02:00 committed by GitHub
parent ab0d892288
commit 54b4f14712
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View 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

View File

@ -0,0 +1,2 @@
:func:`sys.audit` is now called only once per call of :func:`glob.glob` and
:func:`glob.iglob`.