mirror of
https://github.com/python/cpython.git
synced 2024-11-24 10:24:35 +08:00
bpo-38149: Call sys.audit() only once per call for glob.glob(). (GH-18360)
This commit is contained in:
parent
ab0d892288
commit
54b4f14712
@ -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
|
||||
|
@ -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
Block a user