Ensure linkcheck items are comparable

Linkcheck organizes the URLs to checks in a PriorityQueue. The items are
tuples (priority, url, docname, lineno).

Tuples where the lineno is `None` are not comparable with tuples that
have an integer lineno, and PriorityQueue items must be comparable (see
https://bugs.python.org/issue31145).

Fixes an issue when a document contains two links to the same URL, one
with an int line number and the other without line number metadata (such
as an image :target: attribute).

Using 0 instead of None to represent no line number should not lead to
observable changes, the result logger only logs the line number when it
is truthy.

Close #8565
This commit is contained in:
François Freitag
2020-12-22 19:49:53 +01:00
parent 955d6558ec
commit a1b8b1febb
5 changed files with 57 additions and 3 deletions

View File

@@ -20,6 +20,8 @@ Bugs fixed
annotations
* #8568: autodoc: TypeError is raised on checking slots attribute
* #8567: autodoc: Instance attributes are incorrectly added to Parent class
* #8565: linkcheck: Fix PriorityQueue crash when link tuples are not
comparable
Testing
--------