diff --git a/Lib/distutils/command/check.py b/Lib/distutils/command/check.py index 73a30f3afd8..0a5976676a8 100644 --- a/Lib/distutils/command/check.py +++ b/Lib/distutils/command/check.py @@ -125,7 +125,13 @@ def _check_rst_data(self, data): # the include and csv_table directives need this to be a path source_path = self.distribution.script_name or 'setup.py' parser = Parser() - settings = frontend.OptionParser(components=(Parser,)).get_default_values() + try: + get_default_settings = frontend.get_default_settings + except AttributeError: + # Deprecated in Docutils 0.19, may be broken in Docutils 0.21. + settings = frontend.OptionParser(components=(Parser,)).get_default_values() + else: + settings = get_default_settings(Parser) settings.tab_width = 4 settings.pep_references = None settings.rfc_references = None diff --git a/Misc/NEWS.d/next/Library/2024-02-09-17-56-06.gh-issue-115198.QKrxUQ.rst b/Misc/NEWS.d/next/Library/2024-02-09-17-56-06.gh-issue-115198.QKrxUQ.rst new file mode 100644 index 00000000000..78c10aeb4f9 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-02-09-17-56-06.gh-issue-115198.QKrxUQ.rst @@ -0,0 +1 @@ +Fix support of Docutils >= 0.19 in :mod:`distutils`.