You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unguarded ExpatParser.flush() logs a spurious warning on Python < 3.10.14 #2119
ExpatParser.flush isn't part of the documented IncrementalParser interface and doesn't exist before 3.10.14 - verified False on 3.10.0 / 3.10.8 / 3.10.12 / 3.10.13, True on 3.10.14+, all of which satisfy our requires-python = ">=3.10"
consequence on those interpreters: every sitemap parse logs Failed to parse remaining XML data: 'ExpatParser' object has no attribute 'flush' at WARNING
not data loss - flush() contributes 0 items in every scenario I tried (single chunk, 3 chunks, truncated document, 20k <url> entries fed in 1 KiB slices cutting tokens mid-token). Expat's reparse deferral landed in the same release as flush(), so on interpreters without flush() nothing is ever left buffered
so: pure log noise, low priority. Guard with suppress(AttributeError) / getattr, or drop the call
separately, the except swallows the yield loop below it - if flush() ever did raise with items buffered, they'd be discarded. Cheap to make robust by yielding self._handler.items in a finally
Activity
fix(sitemap): guard the unavailable `ExpatParser.flush` on older `CPy…