Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1929b7e

Browse filesBrowse files
authored
[3.13] Docs: Ensure no warnings are found in the NEWS file before a given line number (GH-119221) (#119261)
1 parent f028451 commit 1929b7e
Copy full SHA for 1929b7e

File tree

4 files changed

+45
-4
lines changed
Filter options

4 files changed

+45
-4
lines changed

‎.github/workflows/reusable-docs.yml

Copy file name to clipboardExpand all lines: .github/workflows/reusable-docs.yml
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ jobs:
6262
python Doc/tools/check-warnings.py \
6363
--annotate-diff '${{ env.branch_base }}' '${{ env.branch_pr }}' \
6464
--fail-if-regression \
65-
--fail-if-improved
65+
--fail-if-improved \
66+
--fail-if-new-news-nit
6667
6768
# This build doesn't use problem matchers or check annotations
6869
build_doc_oldest_supported_sphinx:

‎Doc/tools/check-warnings.py

Copy file name to clipboardExpand all lines: Doc/tools/check-warnings.py
+40Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
from pathlib import Path
1414
from typing import TextIO
1515

16+
# Fail if NEWS nit found before this line number
17+
NEWS_NIT_THRESHOLD = 200
18+
1619
# Exclude these whether they're dirty or clean,
1720
# because they trigger a rebuild of dirty files.
1821
EXCLUDE_FILES = {
@@ -245,6 +248,32 @@ def fail_if_improved(
245248
return 0
246249

247250

251+
def fail_if_new_news_nit(warnings: list[str], threshold: int) -> int:
252+
"""
253+
Ensure no warnings are found in the NEWS file before a given line number.
254+
"""
255+
news_nits = (
256+
warning
257+
for warning in warnings
258+
if "/build/NEWS:" in warning
259+
)
260+
261+
# Nits found before the threshold line
262+
new_news_nits = [
263+
nit
264+
for nit in news_nits
265+
if int(nit.split(":")[1]) <= threshold
266+
]
267+
268+
if new_news_nits:
269+
print("\nError: new NEWS nits:\n")
270+
for warning in new_news_nits:
271+
print(warning)
272+
return -1
273+
274+
return 0
275+
276+
248277
def main(argv: list[str] | None = None) -> int:
249278
parser = argparse.ArgumentParser()
250279
parser.add_argument(
@@ -264,6 +293,14 @@ def main(argv: list[str] | None = None) -> int:
264293
action="store_true",
265294
help="Fail if new files with no nits are found",
266295
)
296+
parser.add_argument(
297+
"--fail-if-new-news-nit",
298+
metavar="threshold",
299+
type=int,
300+
nargs="?",
301+
const=NEWS_NIT_THRESHOLD,
302+
help="Fail if new NEWS nit found before threshold line number",
303+
)
267304

268305
args = parser.parse_args(argv)
269306
if args.annotate_diff is not None and len(args.annotate_diff) > 2:
@@ -304,6 +341,9 @@ def main(argv: list[str] | None = None) -> int:
304341
if args.fail_if_improved:
305342
exit_code += fail_if_improved(files_with_expected_nits, files_with_nits)
306343

344+
if args.fail_if_new_news_nit:
345+
exit_code += fail_if_new_news_nit(warnings, args.fail_if_new_news_nit)
346+
307347
return exit_code
308348

309349

+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Fix race condition in free-threaded build where :meth:`list.extend` could expose
2-
uninitialied memory to concurrent readers.
1+
Fix race condition in free-threaded build where :meth:`!list.extend` could
2+
expose uninitialised memory to concurrent readers.
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Fixed handling in :meth:`inspect.signature.bind` of keyword arguments having
1+
Fixed handling in :meth:`inspect.Signature.bind` of keyword arguments having
22
the same name as positional-only arguments when a variadic keyword argument
33
(e.g. ``**kwargs``) is present.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.