diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2020-06-20 08:10:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-20 08:10:31 (GMT) |
commit | 935586845815f5b4c7814794413f6a812d4bd45f (patch) | |
tree | 69297d0f173d3b42895adb1da65c99f1e021b586 /Tools/peg_generator | |
parent | a041e116db5f1e78222cbf2c22aae96457372680 (diff) | |
download | cpython-935586845815f5b4c7814794413f6a812d4bd45f.zip cpython-935586845815f5b4c7814794413f6a812d4bd45f.tar.gz cpython-935586845815f5b4c7814794413f6a812d4bd45f.tar.bz2 |
bpo-41043: Escape literal part of the path for glob(). (GH-20994)
Diffstat (limited to 'Tools/peg_generator')
-rwxr-xr-x | Tools/peg_generator/scripts/test_parse_directory.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Tools/peg_generator/scripts/test_parse_directory.py b/Tools/peg_generator/scripts/test_parse_directory.py index d8f4f0e..a5e26f0 100755 --- a/Tools/peg_generator/scripts/test_parse_directory.py +++ b/Tools/peg_generator/scripts/test_parse_directory.py @@ -7,7 +7,7 @@ import sys import time import traceback import tokenize -from glob import glob +from glob import glob, escape from pathlib import PurePath from typing import List, Optional, Any, Tuple @@ -109,7 +109,7 @@ def parse_directory(directory: str, verbose: bool, excluded_files: List[str], sh files = [] total_seconds = 0 - for file in sorted(glob(f"{directory}/**/*.py", recursive=True)): + for file in sorted(glob(os.path.join(escape(directory), f"**/*.py"), recursive=True)): # Only attempt to parse Python files and files that are not excluded if any(PurePath(file).match(pattern) for pattern in excluded_files): continue |