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

(cherry picked from commit 54b4f14712)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Miss Islington (bot) 2020-02-06 00:45:18 -08:00 committed by GitHub
parent 927d3aab1c
commit 708f472dd9
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`.