docs: sphinx: avoid using the deprecated node.set_class()
authorJonathan Corbet <corbet@lwn.net>
Thu, 19 Jun 2025 21:17:39 +0000 (15:17 -0600)
committerJonathan Corbet <corbet@lwn.net>
Sat, 21 Jun 2025 19:18:03 +0000 (13:18 -0600)
Docutils emits a deprecation warning when the set_class() element method is
used; that warning disappears into the ether, but it also causes a crash
with docutils 0.19.

Avoid the deprecated function and just append directly to the "classes"
attribute like the documentation says instead.

Reported-by: Akira Yokosawa <akiyks@gmail.com>
Tested-by: Akira Yokosawa <akiyks@gmail.com>
Closes: https://lore.kernel.org/de7bae91-3200-481f-9db2-c0dc382c91dd@gmail.com/
Fixes: d6d1df92c25f ("docs: automarkup: Mark up undocumented entities too")
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Documentation/sphinx/automarkup.py

index e67eb8e19c22d2c5fa09449a58865e4bcfb798a6..563033f764bb86067322a386d70375fde44b8d34 100644 (file)
@@ -240,7 +240,7 @@ def add_and_resolve_xref(app, docname, domain, reftype, target, contnode=None):
     # mark it as a broken xref
     #
     if contnode:
-        contnode.set_class("broken_xref")
+        contnode['classes'].append("broken_xref")
     return contnode
 
 #