diff --git a/doc-py38-to-py36.patch b/doc-py38-to-py36.patch index 0f352e2..8b10ad3 100644 --- a/doc-py38-to-py36.patch +++ b/doc-py38-to-py36.patch @@ -1,26 +1,133 @@ --- - Doc/conf.py | 17 ++++++++- - Doc/tools/check-warnings.py | 3 + - Doc/tools/extensions/audit_events.py | 55 ++++++++++++++++---------------- - Doc/tools/extensions/availability.py | 15 ++++---- - Doc/tools/extensions/c_annotations.py | 45 +++++++++++++++----------- - Doc/tools/extensions/glossary_search.py | 10 +---- - Doc/tools/extensions/patchlevel.py | 9 ++--- - 7 files changed, 87 insertions(+), 67 deletions(-) + Doc/Makefile | 8 +-- + Doc/c-api/arg.rst | 1 + Doc/c-api/typeobj.rst | 8 +-- + Doc/conf.py | 29 ++++++++++--- + Doc/howto/free-threading-python.rst | 2 + Doc/library/doctest.rst | 1 + Doc/library/email.compat32-message.rst | 1 + Doc/library/xml.etree.elementtree.rst | 1 + Doc/Makefile | 8 +-- + Doc/c-api/arg.rst | 1 + Doc/c-api/typeobj.rst | 8 +-- + Doc/conf.py | 29 ++++++++++--- + Doc/library/doctest.rst | 1 + Doc/library/email.compat32-message.rst | 1 + Doc/library/xml.etree.elementtree.rst | 1 + Doc/tools/check-warnings.py | 5 +- + Doc/tools/extensions/audit_events.py | 56 ++++++++++++++------------ + Doc/tools/extensions/availability.py | 15 +++--- + Doc/tools/extensions/c_annotations.py | 53 ++++++++++++++++-------- + Doc/tools/extensions/changes.py | 8 +-- + Doc/tools/extensions/glossary_search.py | 20 ++++++--- + Doc/tools/extensions/implementation_detail.py | 22 +++------- + Doc/tools/extensions/issue_role.py | 16 ++----- + Doc/tools/extensions/misc_news.py | 14 ++---- + Doc/tools/extensions/patchlevel.py | 9 ++-- + Doc/tools/extensions/pydoc_topics.py | 22 +++++----- + 18 files changed, 159 insertions(+), 130 deletions(-) ---- a/Doc/conf.py -+++ b/Doc/conf.py -@@ -18,6 +18,9 @@ sys.path.append(os.path.abspath('include - # Python specific content from Doc/Tools/extensions/pyspecific.py - from pyspecific import SOURCE_URI +Index: Python-3.13.5/Doc/Makefile +=================================================================== +--- Python-3.13.5.orig/Doc/Makefile 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/Makefile 2025-06-12 21:38:04.908380762 +0200 +@@ -14,15 +14,15 @@ + SOURCES = + DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py) + REQUIREMENTS = requirements.txt +-SPHINXERRORHANDLING = --fail-on-warning ++SPHINXERRORHANDLING = -+# Needed for fixing extlinks modification -+from sphinx import version_info as sphinx_version + # Internal variables. + PAPEROPT_a4 = --define latex_elements.papersize=a4paper + PAPEROPT_letter = --define latex_elements.papersize=letterpaper + +-ALLSPHINXOPTS = --builder $(BUILDER) \ +- --doctree-dir build/doctrees \ +- --jobs $(JOBS) \ ++ALLSPHINXOPTS = -b $(BUILDER) \ ++ -d build/doctrees \ ++ -j $(JOBS) \ + $(PAPEROPT_$(PAPER)) \ + $(SPHINXOPTS) $(SPHINXERRORHANDLING) \ + . build/$(BUILDER) $(SOURCES) +Index: Python-3.13.5/Doc/c-api/arg.rst +=================================================================== +--- Python-3.13.5.orig/Doc/c-api/arg.rst 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/c-api/arg.rst 2025-06-12 21:38:04.908705133 +0200 +@@ -334,7 +334,6 @@ + should raise an exception and leave the content of *address* unmodified. + + .. c:macro:: Py_CLEANUP_SUPPORTED +- :no-typesetting: + + If the *converter* returns :c:macro:`!Py_CLEANUP_SUPPORTED`, it may get called a + second time if the argument parsing eventually fails, giving the converter a +Index: Python-3.13.5/Doc/c-api/typeobj.rst +=================================================================== +--- Python-3.13.5.orig/Doc/c-api/typeobj.rst 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/c-api/typeobj.rst 2025-06-12 21:38:04.908874058 +0200 +@@ -610,7 +610,7 @@ + Functions like :c:func:`PyObject_NewVar` will take the value of N as an + argument, and store in the instance's :c:member:`~PyVarObject.ob_size` field. + Note that the :c:member:`~PyVarObject.ob_size` field may later be used for +- other purposes. For example, :py:type:`int` instances use the bits of ++ other purposes. For example, :py:obj:`int` instances use the bits of + :c:member:`~PyVarObject.ob_size` in an implementation-defined + way; the underlying storage and its size should be accessed using + :c:func:`PyLong_Export`. +@@ -622,9 +622,9 @@ + + Also, the presence of an :c:member:`~PyVarObject.ob_size` field in the + instance layout doesn't mean that the instance structure is variable-length. +- For example, the :py:type:`list` type has fixed-length instances, yet those ++ For example, the :py:obj:`list` type has fixed-length instances, yet those + instances have a :c:member:`~PyVarObject.ob_size` field. +- (As with :py:type:`int`, avoid reading lists' :c:member:`!ob_size` directly. ++ (As with :py:obj:`int`, avoid reading lists' :c:member:`!ob_size` directly. + Call :c:func:`PyList_Size` instead.) + + The :c:member:`!tp_basicsize` includes size needed for data of the type's +@@ -637,7 +637,7 @@ + In other words, :c:member:`!tp_basicsize` must be greater than or equal + to the base's :c:member:`!tp_basicsize`. + +- Since every type is a subtype of :py:type:`object`, this struct must ++ Since every type is a subtype of :py:obj:`object`, this struct must + include :c:type:`PyObject` or :c:type:`PyVarObject` (depending on + whether :c:member:`~PyVarObject.ob_size` should be included). These are + usually defined by the macro :c:macro:`PyObject_HEAD` or +Index: Python-3.13.5/Doc/conf.py +=================================================================== +--- Python-3.13.5.orig/Doc/conf.py 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/conf.py 2025-06-12 21:38:04.909609597 +0200 +@@ -11,6 +11,8 @@ + from importlib import import_module + from importlib.util import find_spec + ++from sphinx import version_info + - # General configuration - # --------------------- + # Make our custom extensions available to Sphinx + sys.path.append(os.path.abspath('tools/extensions')) + sys.path.append(os.path.abspath('includes')) +@@ -57,11 +59,11 @@ + import _tkinter + except ImportError: + _tkinter = None +-# Treat warnings as errors, done here to prevent warnings in Sphinx code from +-# causing spurious CPython test failures. +-import warnings +-warnings.simplefilter('error') +-del warnings ++# # Treat warnings as errors, done here to prevent warnings in Sphinx code from ++# # causing spurious CPython test failures. ++# import warnings ++# warnings.simplefilter('error') ++# del warnings + ''' -@@ -92,7 +95,7 @@ highlight_language = 'python3' + manpages_url = 'https://manpages.debian.org/{path}' +@@ -92,7 +94,7 @@ # Minimum version of sphinx required # Keep this version in sync with ``Doc/requirements.txt``. @@ -29,7 +136,17 @@ # Create table of contents entries for domain objects (e.g. functions, classes, # attributes, etc.). Default is True. -@@ -360,7 +363,7 @@ html_short_title = f'{release} Documenta +@@ -323,6 +325,9 @@ + # Avoid a warning with Sphinx >= 4.0 + root_doc = 'contents' + ++# Compatibility on old Sphinx ++suppress_warnings = ['pygments.ParserNotFound'] ++ + # Allow translation of index directives + gettext_additional_targets = [ + 'index', +@@ -362,7 +367,7 @@ # (See .readthedocs.yml and https://docs.readthedocs.io/en/stable/reference/environment-variables.html) is_deployment_preview = os.getenv("READTHEDOCS_VERSION_TYPE") == "external" repository_url = os.getenv("READTHEDOCS_GIT_CLONE_URL", "") @@ -38,11 +155,11 @@ html_context = { "is_deployment_preview": is_deployment_preview, "repository_url": repository_url or None, -@@ -605,6 +608,16 @@ extlinks = { +@@ -607,6 +612,16 @@ } extlinks_detect_hardcoded_links = True -+if sphinx_version[:2] < (8, 1): ++if version_info[:2] < (8, 1): + # Sphinx 8.1 has in-built CVE and CWE roles. + extlinks.update({ + "cve": ( @@ -55,9 +172,47 @@ # Options for c_annotations extension # ----------------------------------- ---- a/Doc/tools/check-warnings.py -+++ b/Doc/tools/check-warnings.py -@@ -228,7 +228,8 @@ def fail_if_regression( +Index: Python-3.13.5/Doc/library/doctest.rst +=================================================================== +--- Python-3.13.5.orig/Doc/library/doctest.rst 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/library/doctest.rst 2025-06-12 21:38:04.909944989 +0200 +@@ -308,7 +308,6 @@ + searched. Objects imported into the module are not searched. + + .. attribute:: module.__test__ +- :no-typesetting: + + In addition, there are cases when you want tests to be part of a module but not part + of the help text, which requires that the tests not be included in the docstring. +Index: Python-3.13.5/Doc/library/email.compat32-message.rst +=================================================================== +--- Python-3.13.5.orig/Doc/library/email.compat32-message.rst 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/library/email.compat32-message.rst 2025-06-12 21:38:04.910320877 +0200 +@@ -7,7 +7,6 @@ + :synopsis: The base class representing email messages in a fashion + backward compatible with Python 3.2 + :noindex: +- :no-index: + + + The :class:`Message` class is very similar to the +Index: Python-3.13.5/Doc/library/xml.etree.elementtree.rst +=================================================================== +--- Python-3.13.5.orig/Doc/library/xml.etree.elementtree.rst 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/library/xml.etree.elementtree.rst 2025-06-12 21:38:04.910594893 +0200 +@@ -874,7 +874,6 @@ + + .. module:: xml.etree.ElementTree + :noindex: +- :no-index: + + .. class:: Element(tag, attrib={}, **extra) + +Index: Python-3.13.5/Doc/tools/check-warnings.py +=================================================================== +--- Python-3.13.5.orig/Doc/tools/check-warnings.py 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/tools/check-warnings.py 2025-06-12 21:38:04.910896050 +0200 +@@ -228,7 +228,8 @@ print(filename) for warning in warnings: if filename in warning: @@ -67,9 +222,20 @@ print(" {line}: {msg}".format_map(match)) return -1 return 0 ---- a/Doc/tools/extensions/audit_events.py -+++ b/Doc/tools/extensions/audit_events.py -@@ -1,23 +1,18 @@ +@@ -316,7 +317,7 @@ + + cwd = str(Path.cwd()) + os.path.sep + files_with_nits = { +- warning.removeprefix(cwd).split(":")[0] ++ (warning[len(cwd):].split(":")[0] if warning.startswith(cwd) else warning.split(":")[0]) + for warning in warnings + if "Doc/" in warning + } +Index: Python-3.13.5/Doc/tools/extensions/audit_events.py +=================================================================== +--- Python-3.13.5.orig/Doc/tools/extensions/audit_events.py 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/tools/extensions/audit_events.py 2025-06-12 21:38:04.911151491 +0200 +@@ -1,9 +1,6 @@ """Support for documenting audit events.""" -from __future__ import annotations @@ -78,36 +244,43 @@ -from typing import TYPE_CHECKING from docutils import nodes -+from typing import Any, List, Set, Tuple from sphinx.errors import NoUri - from sphinx.locale import _ as sphinx_gettext - from sphinx.transforms.post_transforms import SphinxPostTransform +@@ -12,12 +9,19 @@ from sphinx.util import logging from sphinx.util.docutils import SphinxDirective -if TYPE_CHECKING: - from collections.abc import Iterator, Set -- -- from sphinx.application import Sphinx -- from sphinx.builders import Builder -- from sphinx.environment import BuildEnvironment ++from typing import Any, Iterator, List, Set, Tuple ++ +from sphinx.application import Sphinx +from sphinx.builders import Builder +from sphinx.environment import BuildEnvironment ++ ++# --- The Monkey Patch --- ++def findall_patch(self, *args, **kwargs): ++ """A backwards-compatible findall method that calls traverse.""" ++ return self.traverse(*args, **kwargs) + +- from sphinx.application import Sphinx +- from sphinx.builders import Builder +- from sphinx.environment import BuildEnvironment ++if not hasattr(nodes.Node, 'findall'): ++ nodes.Node.findall = findall_patch logger = logging.getLogger(__name__) -@@ -32,16 +27,16 @@ _SYNONYMS = [ +@@ -32,16 +36,16 @@ class AuditEvents: def __init__(self) -> None: - self.events: dict[str, list[str]] = {} - self.sources: dict[str, set[tuple[str, str]]] = {} + self.events: dict[str, List[str]] = {} -+ self.sources: dict[str, List[Tuple[str, str]]] = {} ++ self.sources: dict[str, Set[Tuple[str, str]]] = {} - def __iter__(self) -> Iterator[tuple[str, list[str], tuple[str, str]]]: -+ def __iter__(self) -> Any: ++ def __iter__(self) -> Iterator[Any]: for name, args in self.events.items(): for source in self.sources[name]: yield name, args, source @@ -118,7 +291,7 @@ ) -> None: if name in self.events: self._check_args_match(name, args) -@@ -49,7 +44,7 @@ class AuditEvents: +@@ -49,7 +53,7 @@ self.events[name] = args self.sources.setdefault(name, set()).add(source) @@ -127,7 +300,7 @@ current_args = self.events[name] msg = ( f"Mismatched arguments for audit-event {name}: " -@@ -60,7 +55,7 @@ class AuditEvents: +@@ -60,7 +64,7 @@ if len(current_args) != len(args): logger.warning(msg) return @@ -136,16 +309,16 @@ if a1 == a2: continue if any(a1 in s and a2 in s for s in _SYNONYMS): -@@ -73,7 +68,7 @@ class AuditEvents: +@@ -73,7 +77,7 @@ name_clean = re.sub(r"\W", "_", name) return f"audit_event_{name_clean}_{source_count}" - def rows(self) -> Iterator[tuple[str, list[str], Set[tuple[str, str]]]]: -+ def rows(self) -> Any: ++ def rows(self) -> Iterator[Any]: for name in sorted(self.events.keys()): yield name, self.events[name], self.sources[name] -@@ -97,7 +92,7 @@ def audit_events_purge( +@@ -97,7 +101,7 @@ def audit_events_merge( app: Sphinx, env: BuildEnvironment, @@ -154,7 +327,7 @@ other: BuildEnvironment, ) -> None: """In Sphinx parallel builds, this merges audit_events from subprocesses.""" -@@ -126,14 +121,16 @@ class AuditEvent(SphinxDirective): +@@ -126,14 +130,16 @@ ), ] @@ -177,7 +350,7 @@ else: args = [] ids = [] -@@ -169,7 +166,7 @@ class audit_event_list(nodes.General, no +@@ -169,7 +175,7 @@ class AuditEventListDirective(SphinxDirective): @@ -186,20 +359,7 @@ return [audit_event_list()] -@@ -181,7 +178,11 @@ class AuditEventListTransform(SphinxPost - return - - table = self._make_table(self.app.builder, self.env.docname) -- for node in self.document.findall(audit_event_list): -+ try: -+ findall = self.document.findall -+ except AttributeError: -+ findall = self.document.traverse -+ for node in findall(audit_event_list): - node.replace_self(table) - - def _make_table(self, builder: Builder, docname: str) -> nodes.table: -@@ -217,8 +218,8 @@ class AuditEventListTransform(SphinxPost +@@ -217,8 +223,8 @@ builder: Builder, docname: str, name: str, @@ -210,8 +370,10 @@ ) -> nodes.row: row = nodes.row() name_node = nodes.paragraph("", nodes.Text(name)) ---- a/Doc/tools/extensions/availability.py -+++ b/Doc/tools/extensions/availability.py +Index: Python-3.13.5/Doc/tools/extensions/availability.py +=================================================================== +--- Python-3.13.5.orig/Doc/tools/extensions/availability.py 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/tools/extensions/availability.py 2025-06-12 21:38:04.911376735 +0200 @@ -1,8 +1,6 @@ """Support for documenting platform availability""" @@ -222,7 +384,7 @@ from docutils import nodes from sphinx import addnodes -@@ -55,7 +53,7 @@ class Availability(SphinxDirective): +@@ -55,7 +53,7 @@ optional_arguments = 0 final_argument_whitespace = True @@ -231,7 +393,7 @@ title = sphinx_gettext("Availability") refnode = addnodes.pending_xref( title, -@@ -79,7 +77,7 @@ class Availability(SphinxDirective): +@@ -79,7 +77,7 @@ return [cnode] @@ -240,7 +402,7 @@ """Parse platform information from arguments Arguments is a comma-separated string of platforms. A platform may -@@ -98,12 +96,13 @@ class Availability(SphinxDirective): +@@ -98,12 +96,13 @@ platform, _, version = arg.partition(" >= ") if platform.startswith("not "): version = False @@ -256,7 +418,7 @@ logger.warning( "Unknown platform%s or syntax '%s' in '.. availability:: %s', " "see %s:KNOWN_PLATFORMS for a set of known platforms.", -@@ -116,7 +115,7 @@ class Availability(SphinxDirective): +@@ -116,7 +115,7 @@ return platforms @@ -265,9 +427,11 @@ app.add_directive("availability", Availability) return { ---- a/Doc/tools/extensions/c_annotations.py -+++ b/Doc/tools/extensions/c_annotations.py -@@ -9,22 +9,18 @@ Configuration: +Index: Python-3.13.5/Doc/tools/extensions/c_annotations.py +=================================================================== +--- Python-3.13.5.orig/Doc/tools/extensions/c_annotations.py 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/tools/extensions/c_annotations.py 2025-06-12 21:38:04.911575881 +0200 +@@ -9,22 +9,26 @@ * Set ``stable_abi_file`` to the path to stable ABI list. """ @@ -290,10 +454,18 @@ - from sphinx.application import Sphinx - from sphinx.util.typing import ExtensionMetadata +from sphinx.application import Sphinx ++ ++# --- The Monkey Patch --- ++def findall_patch(self, *args, **kwargs): ++ """A backwards-compatible findall method that calls traverse.""" ++ return self.traverse(*args, **kwargs) ++ ++if not hasattr(nodes.Node, 'findall'): ++ nodes.Node.findall = findall_patch ROLE_TO_OBJECT_TYPE = { "func": "function", -@@ -35,20 +31,20 @@ ROLE_TO_OBJECT_TYPE = { +@@ -35,20 +39,20 @@ } @@ -318,7 +490,7 @@ class StableABIEntry: # Role of the object. # Source: Each [item_kind] in stable_abi.toml is mapped to a C Domain role. -@@ -67,7 +63,7 @@ class StableABIEntry: +@@ -67,7 +71,7 @@ struct_abi_kind: str @@ -327,7 +499,7 @@ refcount_data = {} refcounts = refcount_filename.read_text(encoding="utf8") for line in refcounts.splitlines(): -@@ -103,7 +99,7 @@ def read_refcount_data(refcount_filename +@@ -103,7 +107,7 @@ return refcount_data @@ -336,7 +508,7 @@ stable_abi_data = {} with open(stable_abi_file, encoding="utf8") as fp: for record in csv.DictReader(fp): -@@ -123,11 +119,14 @@ def add_annotations(app: Sphinx, doctree +@@ -123,11 +127,14 @@ continue if not par[0].get("ids", None): continue @@ -353,7 +525,7 @@ if ROLE_TO_OBJECT_TYPE[record.role] != objtype: msg = ( f"Object type mismatch in limited API annotation for {name}: " -@@ -234,7 +233,7 @@ def _unstable_api_annotation() -> nodes. +@@ -234,7 +241,7 @@ ) @@ -362,7 +534,7 @@ classes = ["refcount"] if result_refs is None: rc = sphinx_gettext("Return value: Always NULL.") -@@ -254,7 +253,7 @@ class LimitedAPIList(SphinxDirective): +@@ -254,7 +261,7 @@ optional_arguments = 0 final_argument_whitespace = True @@ -371,7 +543,7 @@ state = self.env.domaindata["c_annotations"] content = [ f"* :c:{record.role}:`{record.name}`" -@@ -277,13 +276,23 @@ def init_annotations(app: Sphinx) -> Non +@@ -277,13 +284,23 @@ ) @@ -396,9 +568,50 @@ return { "version": "1.0", "parallel_read_safe": True, ---- a/Doc/tools/extensions/glossary_search.py -+++ b/Doc/tools/extensions/glossary_search.py -@@ -1,18 +1,14 @@ +Index: Python-3.13.5/Doc/tools/extensions/changes.py +=================================================================== +--- Python-3.13.5.orig/Doc/tools/extensions/changes.py 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/tools/extensions/changes.py 2025-06-12 21:38:04.911758715 +0200 +@@ -1,7 +1,5 @@ + """Support for documenting version of changes, additions, deprecations.""" + +-from __future__ import annotations +- + from typing import TYPE_CHECKING + + from sphinx.domains.changeset import ( +@@ -25,7 +23,7 @@ + + + class PyVersionChange(VersionChange): +- def run(self) -> list[Node]: ++ def run(self) -> "list[Node]": + # Replace the 'next' special token with the current development version + self.arguments[0] = expand_version_arg( + self.arguments[0], self.config.release +@@ -43,7 +41,7 @@ + "Deprecated since version %s, removed in version %s" + ) + +- def run(self) -> list[Node]: ++ def run(self) -> "list[Node]": + # Replace the first two arguments (deprecated version and removed version) + # with a single tuple of both versions. + version_deprecated = expand_version_arg( +@@ -73,7 +71,7 @@ + versionlabel_classes[self.name] = "" + + +-def setup(app: Sphinx) -> ExtensionMetadata: ++def setup(app: "Sphinx") -> "ExtensionMetadata": + # Override Sphinx's directives with support for 'next' + app.add_directive("versionadded", PyVersionChange, override=True) + app.add_directive("versionchanged", PyVersionChange, override=True) +Index: Python-3.13.5/Doc/tools/extensions/glossary_search.py +=================================================================== +--- Python-3.13.5.orig/Doc/tools/extensions/glossary_search.py 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/tools/extensions/glossary_search.py 2025-06-12 21:38:04.911907976 +0200 +@@ -1,21 +1,27 @@ """Feature search results for glossary items prominently.""" -from __future__ import annotations @@ -419,7 +632,20 @@ logger = logging.getLogger(__name__) -@@ -52,7 +48,7 @@ def write_glossary_json(app: Sphinx, _ex ++from docutils import nodes ++from sphinx import addnodes ++ ++# --- The Monkey Patch --- ++def findall_patch(self, *args, **kwargs): ++ """A backwards-compatible findall method that calls traverse.""" ++ return self.traverse(*args, **kwargs) ++ ++if not hasattr(nodes.Node, 'findall'): ++ nodes.Node.findall = findall_patch + + def process_glossary_nodes( + app: Sphinx, +@@ -52,7 +58,7 @@ dest.write_text(json.dumps(app.env.glossary_terms), encoding='utf-8') @@ -428,8 +654,169 @@ app.connect('doctree-resolved', process_glossary_nodes) app.connect('build-finished', write_glossary_json) ---- a/Doc/tools/extensions/patchlevel.py -+++ b/Doc/tools/extensions/patchlevel.py +Index: Python-3.13.5/Doc/tools/extensions/implementation_detail.py +=================================================================== +--- Python-3.13.5.orig/Doc/tools/extensions/implementation_detail.py 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/tools/extensions/implementation_detail.py 2025-06-12 21:38:04.912061736 +0200 +@@ -1,17 +1,10 @@ + """Support for marking up implementation details.""" + +-from __future__ import annotations +- +-from typing import TYPE_CHECKING +- + from docutils import nodes + from sphinx.locale import _ as sphinx_gettext + from sphinx.util.docutils import SphinxDirective + +-if TYPE_CHECKING: +- from sphinx.application import Sphinx +- from sphinx.util.typing import ExtensionMetadata +- ++from sphinx.application import Sphinx + + class ImplementationDetail(SphinxDirective): + has_content = True +@@ -21,23 +14,24 @@ + label_text = sphinx_gettext("CPython implementation detail:") + + def run(self): +- self.assert_has_content() +- content_nodes = self.parse_content_to_nodes() ++ container_node = nodes.container() ++ container_node.document = self.state.document # Ensure node has document context ++ self.state.nested_parse(self.content, self.content_offset, container_node) ++ parsed_nodes = container_node.children + + # insert our prefix at the start of the first paragraph +- first_node = content_nodes[0] ++ first_node = parsed_nodes[0] + first_node[:0] = [ + nodes.strong(self.label_text, self.label_text), + nodes.Text(" "), + ] + +- # create a new compound container node +- cnode = nodes.compound("", *content_nodes, classes=["impl-detail"]) ++ cnode = nodes.compound("", *parsed_nodes, classes=["impl-detail"]) + self.set_source_info(cnode) + return [cnode] + + +-def setup(app: Sphinx) -> ExtensionMetadata: ++def setup(app: Sphinx): + app.add_directive("impl-detail", ImplementationDetail) + + return { +Index: Python-3.13.5/Doc/tools/extensions/issue_role.py +=================================================================== +--- Python-3.13.5.orig/Doc/tools/extensions/issue_role.py 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/tools/extensions/issue_role.py 2025-06-12 21:38:04.912236134 +0200 +@@ -1,22 +1,18 @@ + """Support for referencing issues in the tracker.""" + +-from __future__ import annotations +- +-from typing import TYPE_CHECKING ++from typing import TYPE_CHECKING, List, Tuple + + from docutils import nodes + from sphinx.util.docutils import SphinxRole + +-if TYPE_CHECKING: +- from docutils.nodes import Element +- from sphinx.application import Sphinx +- from sphinx.util.typing import ExtensionMetadata ++from docutils.nodes import Element ++from sphinx.application import Sphinx + + + class BPOIssue(SphinxRole): + ISSUE_URI = "https://bugs.python.org/issue?@action=redirect&bpo={0}" + +- def run(self) -> tuple[list[Element], list[nodes.system_message]]: ++ def run(self) -> Tuple[List[Element], List[nodes.system_message]]: + issue = self.text + + # sanity check: there are no bpo issues within these two values +@@ -38,7 +34,7 @@ + class GitHubIssue(SphinxRole): + ISSUE_URI = "https://github.com/python/cpython/issues/{0}" + +- def run(self) -> tuple[list[Element], list[nodes.system_message]]: ++ def run(self) -> Tuple[List[Element], List[nodes.system_message]]: + issue = self.text + + # sanity check: all GitHub issues have ID >= 32426 +@@ -58,7 +54,7 @@ + return [refnode], [] + + +-def setup(app: Sphinx) -> ExtensionMetadata: ++def setup(app: Sphinx) -> "ExtensionMetadata": + app.add_role("issue", BPOIssue()) + app.add_role("gh", GitHubIssue()) + +Index: Python-3.13.5/Doc/tools/extensions/misc_news.py +=================================================================== +--- Python-3.13.5.orig/Doc/tools/extensions/misc_news.py 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/tools/extensions/misc_news.py 2025-06-12 21:38:04.912390144 +0200 +@@ -1,7 +1,5 @@ + """Support for including Misc/NEWS.""" + +-from __future__ import annotations +- + import re + from pathlib import Path + from typing import TYPE_CHECKING +@@ -24,13 +22,13 @@ + +++++++++++ + """ + +-bpo_issue_re: Final[re.Pattern[str]] = re.compile( ++bpo_issue_re: "Final[re.Pattern[str]]" = re.compile( + "(?:issue #|bpo-)([0-9]+)", re.ASCII + ) +-gh_issue_re: Final[re.Pattern[str]] = re.compile( ++gh_issue_re: "Final[re.Pattern[str]]" = re.compile( + "gh-(?:issue-)?([0-9]+)", re.ASCII | re.IGNORECASE + ) +-whatsnew_re: Final[re.Pattern[str]] = re.compile( ++whatsnew_re: "Final[re.Pattern[str]]" = re.compile( + r"^what's new in (.*?)\??$", re.ASCII | re.IGNORECASE | re.MULTILINE + ) + +@@ -42,7 +40,7 @@ + final_argument_whitespace = False + option_spec = {} + +- def run(self) -> list[Node]: ++ def run(self) -> "list[Node]": + # Get content of NEWS file + source, _ = self.get_source_info() + news_file = Path(source).resolve().parent / self.arguments[0] +@@ -54,7 +52,7 @@ + return [nodes.strong(text, text)] + + # remove first 3 lines as they are the main heading +- news_text = news_text.removeprefix(BLURB_HEADER) ++ news_text = news_text[len(BLURB_HEADER):] if news_text.startswith(BLURB_HEADER) else news_text + + news_text = bpo_issue_re.sub(r":issue:`\1`", news_text) + # Fallback handling for GitHub issues +@@ -65,7 +63,7 @@ + return [] + + +-def setup(app: Sphinx) -> ExtensionMetadata: ++def setup(app: "Sphinx") -> "ExtensionMetadata": + app.add_directive("miscnews", MiscNews) + + return { +Index: Python-3.13.5/Doc/tools/extensions/patchlevel.py +=================================================================== +--- Python-3.13.5.orig/Doc/tools/extensions/patchlevel.py 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/tools/extensions/patchlevel.py 2025-06-12 21:38:04.912563631 +0200 @@ -3,7 +3,7 @@ import re import sys @@ -439,7 +826,7 @@ CPYTHON_ROOT = Path( __file__, # cpython/Doc/tools/extensions/patchlevel.py -@@ -26,7 +26,7 @@ class version_info(NamedTuple): # noqa: +@@ -26,7 +26,7 @@ major: int #: Major release number minor: int #: Minor release number micro: int #: Patch release number @@ -448,7 +835,7 @@ serial: int #: Serial release number -@@ -37,7 +37,8 @@ def get_header_version_info() -> version +@@ -37,7 +37,8 @@ defines = {} patchlevel_h = PATCHLEVEL_H.read_text(encoding="utf-8") for line in patchlevel_h.splitlines(): @@ -458,7 +845,7 @@ name, value = m.groups() defines[name] = value -@@ -50,7 +51,7 @@ def get_header_version_info() -> version +@@ -50,7 +51,7 @@ ) @@ -467,3 +854,65 @@ version = f"{info.major}.{info.minor}" release = f"{info.major}.{info.minor}.{info.micro}" if info.releaselevel != "final": +Index: Python-3.13.5/Doc/tools/extensions/pydoc_topics.py +=================================================================== +--- Python-3.13.5.orig/Doc/tools/extensions/pydoc_topics.py 2025-06-12 21:37:37.257659788 +0200 ++++ Python-3.13.5/Doc/tools/extensions/pydoc_topics.py 2025-06-12 21:38:04.912726688 +0200 +@@ -1,21 +1,23 @@ + """Support for building "topic help" for pydoc.""" + +-from __future__ import annotations +- + from time import asctime +-from typing import TYPE_CHECKING ++from typing import TYPE_CHECKING, Tuple + + from sphinx.builders.text import TextBuilder + from sphinx.util import logging +-from sphinx.util.display import status_iterator ++try: ++ from sphinx.util.display import status_iterator ++except ModuleNotFoundError: ++ from sphinx.util import status_iterator + from sphinx.util.docutils import new_document + from sphinx.writers.text import TextTranslator + +-if TYPE_CHECKING: ++try: ++ from typing import Sequence, Set ++except ModuleNotFoundError: + from collections.abc import Sequence, Set + +- from sphinx.application import Sphinx +- from sphinx.util.typing import ExtensionMetadata ++from sphinx.application import Sphinx + + logger = logging.getLogger(__name__) + +@@ -162,7 +164,7 @@ + self.outdir.joinpath("topics.py").write_text(topics, encoding="utf-8") + + +-def _display_labels(item: tuple[str, Sequence[tuple[str, str]]]) -> str: ++def _display_labels(item: Tuple[str, Sequence[Tuple[str, str]]]) -> str: + _docname, label_ids = item + labels = [name for name, _id in label_ids] + if len(labels) > 4: +@@ -170,7 +172,7 @@ + return ", ".join(labels) + + +-def _repr(text: str, /) -> str: ++def _repr(text: str) -> str: + """Return a triple-single-quoted representation of text.""" + if "'''" not in text: + return f"r'''{text}'''" +@@ -178,7 +180,7 @@ + return f"'''{text}'''" + + +-def setup(app: Sphinx) -> ExtensionMetadata: ++def setup(app: Sphinx) -> "ExtensionMetadata": + app.add_builder(PydocTopicsBuilder) + + return { diff --git a/gh126985-mv-pyvenv.cfg2getpath.patch b/gh126985-mv-pyvenv.cfg2getpath.patch index 4105098..d4dace5 100644 --- a/gh126985-mv-pyvenv.cfg2getpath.patch +++ b/gh126985-mv-pyvenv.cfg2getpath.patch @@ -8,10 +8,10 @@ Date: Tue Nov 26 13:46:33 2024 +0000 Lib/test/test_sysconfig.py | 67 --------------------------------------------- 1 file changed, 1 insertion(+), 66 deletions(-) -Index: Python-3.13.3/Lib/test/test_sysconfig.py +Index: Python-3.13.5/Lib/test/test_sysconfig.py =================================================================== ---- Python-3.13.3.orig/Lib/test/test_sysconfig.py 2025-04-15 14:13:08.581364697 +0200 -+++ Python-3.13.3/Lib/test/test_sysconfig.py 2025-04-15 14:13:54.955529034 +0200 +--- Python-3.13.5.orig/Lib/test/test_sysconfig.py 2025-06-12 19:55:42.184491497 +0200 ++++ Python-3.13.5/Lib/test/test_sysconfig.py 2025-06-12 19:56:05.737665419 +0200 @@ -110,6 +110,7 @@ **venv_create_args, ) diff --git a/python313.changes b/python313.changes index e47b4d5..a9124b5 100644 --- a/python313.changes +++ b/python313.changes @@ -42,6 +42,8 @@ Wed Jun 11 22:02:59 UTC 2025 - Matej Cepl - gh-134989: Implement PyObject_DelAttr() and PyObject_DelAttrString() as macros in the limited C API 3.12 and older. Patch by Victor Stinner. +- Substantially rewritten doc-py38-to-py36.patch patch to be more + flexible and covering even unexpected changes. ------------------------------------------------------------------- Mon Jun 9 21:24:09 UTC 2025 - Matej Cepl diff --git a/python313.spec b/python313.spec index bdccbe2..50abd0c 100644 --- a/python313.spec +++ b/python313.spec @@ -264,7 +264,9 @@ BuildRequires: python3-Sphinx >= 4.0.0 %if 0%{?suse_version} >= 1500 BuildRequires: python3-python-docs-theme >= 2022.1 %endif - +%if 0%{?suse_version} < 1599 +BuildRequires: python3-dataclasses +%endif %endif %endif # end of {with doc}