bpo-39567: Add audit for os.walk(), os.fwalk(), Path.glob() and Path.… · python/cpython@f4f445b · GitHub
Skip to content

Commit f4f445b

Browse files
bpo-39567: Add audit for os.walk(), os.fwalk(), Path.glob() and Path.rglob(). (GH-18372)
1 parent 95905ce commit f4f445b

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

Lib/os.py

Lines changed: 7 additions & 3 deletions

Lib/pathlib.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,7 @@ def glob(self, pattern):
11341134
"""Iterate over this subtree and yield all existing files (of any
11351135
kind, including directories) matching the given relative pattern.
11361136
"""
1137+
sys.audit("pathlib.Path.glob", self, pattern)
11371138
if not pattern:
11381139
raise ValueError("Unacceptable pattern: {!r}".format(pattern))
11391140
drv, root, pattern_parts = self._flavour.parse_parts((pattern,))
@@ -1148,6 +1149,7 @@ def rglob(self, pattern):
11481149
directories) matching the given relative pattern, anywhere in
11491150
this subtree.
11501151
"""
1152+
sys.audit("pathlib.Path.rglob", self, pattern)
11511153
drv, root, pattern_parts = self._flavour.parse_parts((pattern,))
11521154
if drv or root:
11531155
raise NotImplementedError("Non-relative patterns are unsupported")
Lines changed: 2 additions & 0 deletions

0 commit comments

Comments
 (0)