Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add lineno to exceptions
Thanks to Ruff for reminding me
  • Loading branch information
encukou committed Jul 22, 2024
commit d163647ea500874a1d79831c73aee29b2bbe620a
12 changes: 8 additions & 4 deletions Doc/tools/version_next.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,14 @@ def main(argv):
lines = []
with open(path, encoding='utf-8') as file:
for lineno, line in enumerate(file, start=1):
if match := DIRECTIVE_RE.fullmatch(line):
line = match['before'] + version + match['after']
num_changed_lines += 1
lines.append(line)
try:
if match := DIRECTIVE_RE.fullmatch(line):
line = match['before'] + version + match['after']
num_changed_lines += 1
lines.append(line)
except Exception as exc:
exc.add_note(f'processing line {path}:{lineno}')
raise
if num_changed_lines:
if args.verbose:
print(f'Updating file {path} ({num_changed_lines} changes)',
Expand Down