Conversation
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
Fixes #343. The lxml fragment builder returns an empty list for empty input (and for a fragment containing only a doctype). Its walker wraps that list in
Root, whose length was always one, so walking an otherwise valid empty fragment attempted to read a nonexistent child.Nonewhen a document has neither text nor children.Verification
On Windows, Python 3.12.10, pytest 7.4.4, lxml 6.1.3, chardet 7.6.0:
test_stream.py::test_char_win1252failure: installed chardet guessesbig5rather thanwindows-1252. This is unrelated to the walker change and has not been modified or hidden.flake8 . --extend-exclude=.venv, excluding only the local virtual environment).The full tox/platform/Python matrix and documentation build have not been run locally. Setuptools was kept below 81 locally for this checkout's existing
pkg_resourcesdependency; no dependency files were changed. All inputs are synthetic or existing public fixtures.Remote CI
AppVeyor build 1.0.449: Python 2.7 base passed; the optional Python 2.7 job fails installing lxml because Microsoft Visual C++ 9.0 is missing, and both Python 3.7 jobs fail before installation because the runner has no matching Python runtime. The preceding build 1.0.448 on PR #608 has the same three infrastructure failures. These jobs did not run this PR's tests, and the overall CI status is failure, not success. GitHub Actions is awaiting maintainer approval.
AI assistance (OpenAI Codex) was used for investigation, implementation, and regression testing. The diff and before/after results were checked against the current upstream master.