bpo-43756: Add new audit event for new arguments added to glob.glob (GH-25239)

This commit is contained in:
Saiyang Gou 2021-04-21 15:42:55 -07:00 committed by GitHub
parent 7b86e47617
commit a32f8fe713
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -65,6 +65,7 @@ For example, ``'[?]'`` matches the character ``'?'``.
match.
.. audit-event:: glob.glob pathname,recursive glob.glob
.. audit-event:: glob.glob/2 pathname,recursive,root_dir,dir_fd glob.glob
.. note::
Using the "``**``" pattern in large directory trees may consume
@ -83,6 +84,13 @@ For example, ``'[?]'`` matches the character ``'?'``.
without actually storing them all simultaneously.
.. audit-event:: glob.glob pathname,recursive glob.iglob
.. audit-event:: glob.glob/2 pathname,recursive,root_dir,dir_fd glob.iglob
.. versionchanged:: 3.5
Support for recursive globs using "``**``".
.. versionchanged:: 3.10
Added the *root_dir* and *dir_fd* parameters.
.. function:: escape(pathname)
@ -128,4 +136,3 @@ default. For example, consider a directory containing :file:`card.gif` and
Module :mod:`fnmatch`
Shell-style filename (not path) expansion

View File

@ -34,6 +34,7 @@ def iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False):
zero or more directories and subdirectories.
"""
sys.audit("glob.glob", pathname, recursive)
sys.audit("glob.glob/2", pathname, recursive, root_dir, dir_fd)
if root_dir is not None:
root_dir = os.fspath(root_dir)
else:

View File

@ -0,0 +1,2 @@
Add new audit event ``glob.glob/2`` to incorporate the new *root_dir* and
*dir_fd* arguments added to :func:`glob.glob` and :func:`glob.iglob`.