bpo-41043: Escape literal part of the path for glob(). (GH-20994)

This commit is contained in:
Serhiy Storchaka 2020-06-20 11:10:31 +03:00 committed by GitHub
parent a041e116db
commit 9355868458
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 37 additions and 31 deletions

View file

@ -70,7 +70,7 @@ class BaseTest(unittest.TestCase):
# simply use the bigger test data for all tests.
test_size = 0
BIG_TEXT = bytearray(128*1024)
for fname in glob.glob(os.path.join(os.path.dirname(__file__), '*.py')):
for fname in glob.glob(os.path.join(glob.escape(os.path.dirname(__file__)), '*.py')):
with open(fname, 'rb') as fh:
test_size += fh.readinto(memoryview(BIG_TEXT)[test_size:])
if test_size > 128*1024: