Skip to contentSkip to conversation

docs: extensions: don't use deprecated ErrorString, SafeString

PATCH In review Daniel Garcia Moreno 2 participants 4 messages Sep 25, 2025 – Sep 26, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs: extensions: don't use deprecated ErrorString, SafeString

This patch replaces the usage of deprecated docutils ErrorString and SafeString.

docutils.utils.error_reporting module was removed in the lastest release 0.22. In the previous release the usage of ErrorString and SafeString was deprecated and the recomendation is to replace the usage with:

Replacements:

     | SafeString  -> str
     | ErrorString -> docutils.io.error_string()
     | ErrorOutput -> docutils.io.ErrorOutput

https://sourceforge.net/p/docutils/code/HEAD/tree/tags/docutils-0.21.2/docutils/utils/error_reporting.py

---
 Documentation/sphinx/kernel_feat.py         | 1 -
 Documentation/sphinx/kernel_include.py      | 8 ++++----
 Documentation/sphinx/maintainers_include.py | 4 ++--
 3 files changed, 6 insertions(+), 7 deletions(-)
Documentation/sphinx/kernel_feat.py +0 -1
index e3a51867f27b..82600e045fe6 100644
@@ -40,7 +40,6 @@ import sys
 from docutils import nodes, statemachine
 from docutils.statemachine import ViewList
 from docutils.parsers.rst import directives, Directive
-from docutils.utils.error_reporting import ErrorString
 from sphinx.util.docutils import switch_source_input
 
 __version__  = '1.0'
Documentation/sphinx/kernel_include.py +4 -4
index 1e566e87ebcd..42945b1779eb 100755
@@ -35,7 +35,7 @@
 import os.path
 
 from docutils import io, nodes, statemachine
-from docutils.utils.error_reporting import SafeString, ErrorString
+from docutils.io import error_string
 from docutils.parsers.rst import directives
 from docutils.parsers.rst.directives.body import CodeBlock, NumberLines
 from docutils.parsers.rst.directives.misc import Include
@@ -112,10 +112,10 @@ class KernelInclude(Include):
             raise self.severe('Problems with "%s" directive path:\n'
                               'Cannot encode input file path "%s" '
                               '(wrong locale?).' %
-                              (self.name, SafeString(path)))
+                              (self.name, str(path)))
         except IOError as error:
             raise self.severe('Problems with "%s" directive path:\n%s.' %
-                      (self.name, ErrorString(error)))
+                      (self.name, error_string(error)))
         startline = self.options.get('start-line', None)
         endline = self.options.get('end-line', None)
         try:
@@ -126,7 +126,7 @@ class KernelInclude(Include):
                 rawtext = include_file.read()
         except UnicodeError as error:
             raise self.severe('Problem with "%s" directive:\n%s' %
-                              (self.name, ErrorString(error)))
+                              (self.name, error_string(error)))
         # start-after/end-before: no restrictions on newlines in match-text,
         # and no restrictions on matching inside lines vs. line boundaries
         after_text = self.options.get('start-after', None)
Documentation/sphinx/maintainers_include.py +2 -2
index d31cff867436..9414bdf7bfc0 100755
@@ -22,7 +22,7 @@ import re
 import os.path
 
 from docutils import statemachine
-from docutils.utils.error_reporting import ErrorString
+from docutils.io import error_string
 from docutils.parsers.rst import Directive
 from docutils.parsers.rst.directives.misc import Include
 
@@ -190,6 +190,6 @@ class MaintainersInclude(Include):
             lines = self.parse_maintainers(path)
         except IOError as error:
             raise self.severe('Problems with "%s" directive path:\n%s.' %
-                      (self.name, ErrorString(error)))
+                      (self.name, error_string(error)))
 
         return []
Signature · 1 line
2.51.0
maintainer
#1 lore raw
Quoted 12 lines · Daniel Garcia Moreno

This patch replaces the usage of deprecated docutils ErrorString and SafeString.

docutils.utils.error_reporting module was removed in the lastest release 0.22. In the previous release the usage of ErrorString and SafeString was deprecated and the recomendation is to replace the usage with:

   Replacements:
     | SafeString  -> str
     | ErrorString -> docutils.io.error_string()
     | ErrorOutput -> docutils.io.ErrorOutput
Quoted 8 lines

https://sourceforge.net/p/docutils/code/HEAD/tree/tags/docutils-0.21.2/docutils/utils/error_reporting.py

---
 Documentation/sphinx/kernel_feat.py         | 1 -
 Documentation/sphinx/kernel_include.py      | 8 ++++----
 Documentation/sphinx/maintainers_include.py | 4 ++--
 3 files changed, 6 insertions(+), 7 deletions(-)

A couple of things that are good to do when sending kernel patches:

- Check linux-next first
- CC the maintainer

This one has already been dealt with:

https://lore.kernel.org/all/[email protected]/

Thanks,

jon

#2 lore raw
Quoted 24 lines · Jonathan Corbet
Quoted 13 lines · Daniel Garcia Moreno

This patch replaces the usage of deprecated docutils ErrorString and SafeString.

docutils.utils.error_reporting module was removed in the lastest release
0.22. In the previous release the usage of ErrorString and SafeString was deprecated and the recomendation is to replace the usage with:

   Replacements:

     | SafeString  -> str
     | ErrorString -> docutils.io.error_string()
     | ErrorOutput -> docutils.io.ErrorOutput
Quoted 8 lines

https://sourceforge.net/p/docutils/code/HEAD/tree/tags/docutils-0.21.2/docutils/utils/error_reporting.py

---
 Documentation/sphinx/kernel_feat.py         | 1 - Documentation/sphinx/kernel_include.py      | 8 ++++---- Documentation/sphinx/maintainers_include.py | 4 ++--

 3 files changed, 6 insertions(+), 7 deletions(-)
Quoted 9 lines

A couple of things that are good to do when sending kernel patches:

- Check linux-next first
- CC the maintainer

This one has already been dealt with:

  https://lore.kernel.org/all/[email protected]/

Okay, sorry for the noise. I looked for this patch in the mailing list archive but looks like I didn't look too far.

And of course, I should have checked the linux-next repo. I will check more carefully next time to do not spent time trying to solve something already fixed.

Regards.

maintainer
#3 lore raw
Quoted 6 lines · [email protected] writes:

Okay, sorry for the noise. I looked for this patch in the mailing list archive but looks like I didn't look too far.

And of course, I should have checked the linux-next repo. I will check more carefully next time to do not spent time trying to solve something already fixed.

No worries - thanks for working to make our documentation better!

jon