SF.net SVN: docutils:[10130 ] trunk/docutils

milde--- via Docutils-checkins <[email protected]> Wed, 14 May 2025 09:18:31 +0000
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 10130
          http://sourceforge.net/p/docutils/code/10130
Author:   milde
Date:     2025-05-14 09:18:09 +0000 (Wed, 14 May 2025)
Log Message:
-----------
Log entries for [r10129]. Deprecate `parsers.rst.states.Struct`.

Replace local definition of `parsers.rst.states.Struct` with
an import of `types.SimpleNamespace` (available since Python 3.3).

Modified Paths:
--------------
    trunk/docutils/HISTORY.rst
    trunk/docutils/RELEASE-NOTES.rst
    trunk/docutils/docutils/parsers/rst/states.py

Modified: trunk/docutils/HISTORY.rst
===================================================================
--- trunk/docutils/HISTORY.rst	2025-05-13 20:49:37 UTC (rev 10129)
+++ trunk/docutils/HISTORY.rst	2025-05-14 09:18:09 UTC (rev 10130)
@@ -21,6 +21,14 @@
 
   - Pass default settings to custom parser for included file.
 
+* docutils/parsers/rst/states.py
+
+  - Remove the list`states.RSTStateMachine.memo.section_parents`
+    (introduced in Docutils 0.22rc1) that broke 3rd-party applications
+    setting up a "mock memo".
+  - Use `types.SimpleNamespace` instead of a local definition for
+    the auxilliary class `states.Struct`.
+
 * docutils/writers/_html_base.py
 
   - Fix error when determining the document metadata title from the

Modified: trunk/docutils/RELEASE-NOTES.rst
===================================================================
--- trunk/docutils/RELEASE-NOTES.rst	2025-05-13 20:49:37 UTC (rev 10129)
+++ trunk/docutils/RELEASE-NOTES.rst	2025-05-14 09:18:09 UTC (rev 10130)
@@ -219,8 +219,14 @@
 Release 0.22rc2 (unpublished)
 =============================
 
-Nothing yet.
+Fix backwards-compatibility problem:
+  reStructuredText section parsing no longer requires
+  `parsers.rst.states.RSTStateMachine.memo.section_parents`
+  (a cache introduced in Docutils 0.22rc1).
 
+Deprecate `parsers.rst.states.Struct` (obsoleted by `types.SimpleNamespace`).
+
+
 Release 0.22rc1 (2025-05-06)
 ============================
 

Modified: trunk/docutils/docutils/parsers/rst/states.py
===================================================================
--- trunk/docutils/docutils/parsers/rst/states.py	2025-05-13 20:49:37 UTC (rev 10129)
+++ trunk/docutils/docutils/parsers/rst/states.py	2025-05-14 09:18:09 UTC (rev 10130)
@@ -26,7 +26,7 @@
     - `SpecializedText`: Superclass for continuation lines of Text-variants.
     - `Definition`: Second line of potential definition_list_item.
     - `Line`: Second line of overlined section title or transition marker.
-    - `Struct`: An auxiliary collection class.
+    - `Struct`: obsolete, use `types.SimpleNamespace`.
 
 :Exception classes:
     - `MarkupError`
@@ -105,6 +105,7 @@
 
 import re
 from types import FunctionType, MethodType
+from types import SimpleNamespace as Struct
 
 from docutils import nodes, statemachine, utils
 from docutils import ApplicationError, DataError
@@ -129,14 +130,6 @@
 class MarkupMismatch(Exception): pass
 
 
-class Struct:
-
-    """Stores data attributes for dotted-attribute access."""
-
-    def __init__(self, **keywordargs) -> None:
-        self.__dict__.update(keywordargs)
-
-
 class RSTStateMachine(StateMachineWS):
 
     """

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



_______________________________________________
Docutils-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/docutils-checkins