From 92c82dd5bbf6c71ba1253b6bfce23000d1158e38 Mon Sep 17 00:00:00 2001 From: Ian Wilson Date: Wed, 26 Aug 2026 23:34:24 -0700 Subject: [PATCH 1/2] Stop introspecting rawdata after Python 3.14.7 internal buffering added. --- tdom/parser.py | 15 +-------------- tdom/parser_test.py | 16 ---------------- 2 files changed, 1 insertion(+), 30 deletions(-) diff --git a/tdom/parser.py b/tdom/parser.py index 40277b8..1287070 100644 --- a/tdom/parser.py +++ b/tdom/parser.py @@ -504,24 +504,11 @@ def reset(self): self.sinfo_table = {} def close(self) -> None: - if self.waiting_for_data(): - # We apply heuristics here to try to guess why the parser didn't finish. - if self.rawdata.count('"') % 2 == 1 or self.rawdata.count("'") % 2 == 1: - raise ValueError( - "Parser expects more data, maybe you left an attribute quote unclosed?" - ) - else: - raise ValueError( - "Parser expects more data, is the template valid html?" - ) + super().close() if self.stack: raise ValueError("Invalid HTML structure: unclosed tags remain.") if self.source and self.source.has_placeholders(): raise ValueError("Some placeholders were never resolved.") - super().close() - - def waiting_for_data(self): - return len(self.rawdata) > 0 # ------------------------------------------ # Getting the parsed node tree diff --git a/tdom/parser_test.py b/tdom/parser_test.py index 8d32785..47fc19b 100644 --- a/tdom/parser_test.py +++ b/tdom/parser_test.py @@ -556,22 +556,6 @@ def test_iter(self): ) -class TestIncompleteParsing: - def test_dangling_quotes(self): - with pytest.raises(ValueError, match="Parser expects more data"): - _ = parse_root(t"
x" + expected = "" + assert html(template) == expected