diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py310.txt b/stdlib/@tests/stubtest_allowlists/darwin-py310.txt index cc1ebe489923..331f922dab66 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py310.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py310.txt @@ -1,3 +1,11 @@ +# ======= +# <= 3.12 +# ======= + +# Added in Python 3.10.18 (parameter `escapable`) +html.parser.HTMLParser.set_cdata_mode + + # ======= # <= 3.11 # ======= diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py311.txt b/stdlib/@tests/stubtest_allowlists/darwin-py311.txt index 77dc5722ae5e..2d8079d43541 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py311.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py311.txt @@ -8,6 +8,14 @@ fcntl.F_OFD_SETLK fcntl.F_OFD_SETLKW +# ======= +# <= 3.12 +# ======= + +# Added in Python 3.11.13 (parameter `escapable`) +html.parser.HTMLParser.set_cdata_mode + + # ======= # <= 3.11 # ======= diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py312.txt b/stdlib/@tests/stubtest_allowlists/darwin-py312.txt index cfe4e918f56a..c81581eb72b2 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py312.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py312.txt @@ -8,6 +8,14 @@ fcntl.F_OFD_SETLK fcntl.F_OFD_SETLKW +# ======= +# <= 3.12 +# ======= + +# Added in Python 3.12.11 (parameter `escapable`) +html.parser.HTMLParser.set_cdata_mode + + # ============================================================= # Allowlist entries that cannot or should not be fixed; <= 3.12 # ============================================================= diff --git a/stdlib/@tests/stubtest_allowlists/darwin-py39.txt b/stdlib/@tests/stubtest_allowlists/darwin-py39.txt index e11829830070..59728a27f23c 100644 --- a/stdlib/@tests/stubtest_allowlists/darwin-py39.txt +++ b/stdlib/@tests/stubtest_allowlists/darwin-py39.txt @@ -1,3 +1,11 @@ +# ======= +# <= 3.12 +# ======= + +# Added in Python 3.9.23 (parameter `escapable`) +html.parser.HTMLParser.set_cdata_mode + + # ======= # <= 3.11 # ======= diff --git a/stdlib/@tests/stubtest_allowlists/win32-py310.txt b/stdlib/@tests/stubtest_allowlists/win32-py310.txt index ca56d2f0e687..a49447e799b3 100644 --- a/stdlib/@tests/stubtest_allowlists/win32-py310.txt +++ b/stdlib/@tests/stubtest_allowlists/win32-py310.txt @@ -1,3 +1,11 @@ +# ======= +# <= 3.12 +# ======= + +# Added in Python 3.10.18 (parameter `escapable`) +html.parser.HTMLParser.set_cdata_mode + + # ======= # <= 3.11 # ======= diff --git a/stdlib/@tests/stubtest_allowlists/win32-py311.txt b/stdlib/@tests/stubtest_allowlists/win32-py311.txt index fe33c11f3b6c..62c544055dcc 100644 --- a/stdlib/@tests/stubtest_allowlists/win32-py311.txt +++ b/stdlib/@tests/stubtest_allowlists/win32-py311.txt @@ -1,3 +1,11 @@ +# ======= +# <= 3.12 +# ======= + +# Added in Python 3.11.13 (parameter `escapable`) +html.parser.HTMLParser.set_cdata_mode + + # ======= # <= 3.11 # ======= diff --git a/stdlib/@tests/stubtest_allowlists/win32-py312.txt b/stdlib/@tests/stubtest_allowlists/win32-py312.txt index 3e5762cbf3d1..1c808d36db4e 100644 --- a/stdlib/@tests/stubtest_allowlists/win32-py312.txt +++ b/stdlib/@tests/stubtest_allowlists/win32-py312.txt @@ -16,6 +16,14 @@ _winapi.GetLongPathName _winapi.GetShortPathName +# ======= +# <= 3.12 +# ======= + +# Added in Python 3.12.11 (parameter `escapable`) +html.parser.HTMLParser.set_cdata_mode + + # ============================================================= # Allowlist entries that cannot or should not be fixed; <= 3.12 # ============================================================= diff --git a/stdlib/@tests/stubtest_allowlists/win32-py39.txt b/stdlib/@tests/stubtest_allowlists/win32-py39.txt index 41f8ff3afd8a..ace75c0b6c20 100644 --- a/stdlib/@tests/stubtest_allowlists/win32-py39.txt +++ b/stdlib/@tests/stubtest_allowlists/win32-py39.txt @@ -1,3 +1,11 @@ +# ======= +# <= 3.12 +# ======= + +# Added in Python 3.9.23 (parameter `escapable`) +html.parser.HTMLParser.set_cdata_mode + + # ======= # <= 3.11 # ======= diff --git a/stdlib/html/parser.pyi b/stdlib/html/parser.pyi index 8b3fce0010b7..7edd39e8c703 100644 --- a/stdlib/html/parser.pyi +++ b/stdlib/html/parser.pyi @@ -1,4 +1,3 @@ -import sys from _markupbase import ParserBase from re import Pattern from typing import Final @@ -7,9 +6,8 @@ __all__ = ["HTMLParser"] class HTMLParser(ParserBase): CDATA_CONTENT_ELEMENTS: Final[tuple[str, ...]] - if sys.version_info >= (3, 13): - # Added in 3.13.6 - RCDATA_CONTENT_ELEMENTS: Final[tuple[str, ...]] + # Added in Python 3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.6 + RCDATA_CONTENT_ELEMENTS: Final[tuple[str, ...]] def __init__(self, *, convert_charrefs: bool = True) -> None: ... def feed(self, data: str) -> None: ... @@ -32,11 +30,8 @@ class HTMLParser(ParserBase): def parse_html_declaration(self, i: int) -> int: ... # undocumented def parse_pi(self, i: int) -> int: ... # undocumented def parse_starttag(self, i: int) -> int: ... # undocumented - if sys.version_info >= (3, 13): - # `escapable` parameter added in 3.13.6 - def set_cdata_mode(self, elem: str, *, escapable: bool = False) -> None: ... # undocumented - else: - def set_cdata_mode(self, elem: str) -> None: ... # undocumented + # `escapable` parameter added in Python 3.9.23, 3.10.18, 3.11.13, 3.12.11, 3.13.6 + def set_cdata_mode(self, elem: str, *, escapable: bool = False) -> None: ... # undocumented rawdata: str # undocumented cdata_elem: str | None # undocumented convert_charrefs: bool # undocumented