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:
parent
927d3aab1c
commit
708f472dd9
|
@ -31,6 +31,7 @@ def iglob(pathname, *, recursive=False):
|
||||||
If recursive is true, the pattern '**' will match any files and
|
If recursive is true, the pattern '**' will match any files and
|
||||||
zero or more directories and subdirectories.
|
zero or more directories and subdirectories.
|
||||||
"""
|
"""
|
||||||
|
sys.audit("glob.glob", pathname, recursive)
|
||||||
it = _iglob(pathname, recursive, False)
|
it = _iglob(pathname, recursive, False)
|
||||||
if recursive and _isrecursive(pathname):
|
if recursive and _isrecursive(pathname):
|
||||||
s = next(it) # skip empty string
|
s = next(it) # skip empty string
|
||||||
|
@ -38,7 +39,6 @@ def iglob(pathname, *, recursive=False):
|
||||||
return it
|
return it
|
||||||
|
|
||||||
def _iglob(pathname, recursive, dironly):
|
def _iglob(pathname, recursive, dironly):
|
||||||
sys.audit("glob.glob", pathname, recursive)
|
|
||||||
dirname, basename = os.path.split(pathname)
|
dirname, basename = os.path.split(pathname)
|
||||||
if not has_magic(pathname):
|
if not has_magic(pathname):
|
||||||
assert not dironly
|
assert not dironly
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
:func:`sys.audit` is now called only once per call of :func:`glob.glob` and
|
||||||
|
:func:`glob.iglob`.
|
Loading…
Reference in New Issue