Fix SAXError handling: stop emitting error when resume_saxerror is true#302
Merged
danmactough merged 1 commit intomasterfrom Mar 26, 2026
Merged
Fix SAXError handling: stop emitting error when resume_saxerror is true#302danmactough merged 1 commit intomasterfrom
danmactough merged 1 commit intomasterfrom
Conversation
Emitting an error event is incompatible with resuming parsing because readable-stream immediately unpibes the destination on error. When resume_saxerror is true (default), SAXErrors are now silently collected in feedparser.errors and parsing continues. When false, the error is emitted and parsing aborts. Adds tests for both behaviors. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
resume_saxerroristrue(default), SAXErrors are now silently collected infeedparser.errorsinstead of being emitted onerror. Parsing continues normally.resume_saxerrorisfalse, the SAXError is emitted onerrorand parsing aborts.errorevent andresume_saxerroroption behavior.Why this is a patch release
This fixes a self-contradictory behavior: the old code emitted
errorand then attempted to resume parsing, butreadable-streamimmediately unpipes the destination stream when anerrorevent is emitted, which preventsendfrom being emitted — making "emit and resume" physically impossible. Any consumer relying onerrorevents for SAXErrors while expecting parsing to continue would have already found their pipe broken. (Strictly speaking, parsing could continue, but because the pipe is broken the consumer will hang unless they abort on error -- in which case they'll abort the parsing.) There is no valid usage pattern being removed. This is a bug fix that makes actual behavior match documented intent, not a removal of a working API contract.Test plan
resume_saxerror: true(default): noerrorevent, all items parsed, SAXError infeedparser.errorsresume_saxerror: false:errorevent fired, parsing aborts, error also infeedparser.errorsnpm test)🤖 Generated with Claude Code