8000 gh-121277: Allow `.. versionadded:: next` in docs by encukou · Pull Request #121278 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-121277: Allow .. versionadded:: next in docs #121278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Sep 25, 2024
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 @@ -12,12 +12,12 @@

"""

import re
import sys
import argparse
from pathlib import Path

DIRECTIVE_RE = re.compile(

Check failure on line 20 in Doc/tools/version_next.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (I001)

Doc/tools/version_next.py:15:1: I001 Import block is un-sorted or un-formatted
r'''
(?P<before>
\s*\.\.\s+
Expand Down Expand Up @@ -63,10 +63,14 @@
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
Loading
0