summaryrefslogtreecommitdiffstats
path: root/Lib/pathlib.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-02-12 10:11:34 (GMT)
committerGitHub <noreply@github.com>2020-02-12 10:11:34 (GMT)
commitf4f445b69306c68a2ba8ce8eb8c6cb3064db5fe7 (patch)
treead5200e0984a2832e67870b7f95165998570f772 /Lib/pathlib.py
parent95905ce0f41fd42eb1ef60ddb83f057401c3d52f (diff)
downloadcpython-f4f445b69306c68a2ba8ce8eb8c6cb3064db5fe7.zip
cpython-f4f445b69306c68a2ba8ce8eb8c6cb3064db5fe7.tar.gz
cpython-f4f445b69306c68a2ba8ce8eb8c6cb3064db5fe7.tar.bz2
bpo-39567: Add audit for os.walk(), os.fwalk(), Path.glob() and Path.rglob(). (GH-18372)
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r--Lib/pathlib.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index a5f3313..cfa574a 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -1134,6 +1134,7 @@ class Path(PurePath):
"""Iterate over this subtree and yield all existing files (of any
kind, including directories) matching the given relative pattern.
"""
+ sys.audit("pathlib.Path.glob", self, pattern)
if not pattern:
raise ValueError("Unacceptable pattern: {!r}".format(pattern))
drv, root, pattern_parts = self._flavour.parse_parts((pattern,))
@@ -1148,6 +1149,7 @@ class Path(PurePath):
directories) matching the given relative pattern, anywhere in
this subtree.
"""
+ sys.audit("pathlib.Path.rglob", self, pattern)
drv, root, pattern_parts = self._flavour.parse_parts((pattern,))
if drv or root:
raise NotImplementedError("Non-relative patterns are unsupported")