diff --git a/.python-version b/.python-version index 3f0a10f..a128d5c 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.14.6 +3.14.7 diff --git a/tdom/parser.py b/tdom/parser.py index 40277b8..446ab04 100644 --- a/tdom/parser.py +++ b/tdom/parser.py @@ -503,7 +503,19 @@ def reset(self): self.source = None self.sinfo_table = {} + def flush_pending(self): + """Flush pending into rawdata.""" + # @BWC: Pending added in 3.14.7+ + pending: list[str] | None = getattr(self, "_pending", None) + if pending: + self.rawdata += "".join(pending) + pending.clear() + if hasattr(self, "_pending_len"): + self._pending_len = 0 + self.goahead(False) # False == 0 + def close(self) -> None: + self.flush_pending() 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: