bpo-47146: Avoid Using make Recursively (gh-32206)

https://bugs.python.org/issue47146
This commit is contained in:
Eric Snow 2022-03-30 19:24:02 -06:00 committed by GitHub
parent f3d5715492
commit db4dada510
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 10 deletions

View file

@ -115,7 +115,12 @@ def iter_global_strings():
id_regex = re.compile(r'\b_Py_ID\((\w+)\)')
str_regex = re.compile(r'\b_Py_DECLARE_STR\((\w+), "(.*?)"\)')
for filename in iter_files():
with open(filename, encoding='utf-8') as infile:
try:
infile = open(filename, encoding='utf-8')
except FileNotFoundError:
# The file must have been a temporary file.
continue
with infile:
for lno, line in enumerate(infile, 1):
for m in id_regex.finditer(line):
identifier, = m.groups()