Skip to content

Ignore invalid numeric GML polygon position lists - #607

Open
guocn wants to merge 1 commit into
kurtmckee:mainfrom
guocn:fix/invalid-gml-polygon-599
Open

guocn wants to merge 1 commit into
kurtmckee:mainfrom
guocn:fix/invalid-gml-polygon-599

Conversation

@guocn

@guocn guocn commented Oct 13, 2026

Copy link
Copy Markdown

Summary

Addresses the malformed GML polygon position-list case in #599 (not all cases in that umbrella issue).

_parse_georss_line() returns None for invalid numeric coordinates, but the polygon branch of _parse_poslist() unconditionally indexes that result. Consequently an invalid numeric token such as . raises TypeError through public feedparser.parse().

Return None when the ring parser fails, matching the existing geometry-parser failure contract. The existing _end_gml_poslist() already ignores an unsuccessful geometry result. Valid polygon coordinates, coordinate ordering and unrelated feed data are preserved. This does not change polygon validity/closure rules or broaden exception catching.

Added 11 regressions/controls: three helper inputs, the same three complete Atom/GML feeds through both strict and loose parsers, the issue's minimized malformed input, and a valid ring control. Included a Fixed changelog fragment.

Checked #600/#602/#603/#604 and current open PRs: they address other #599 failures; none handles this invalid ring result.

Verification

Linux x86_64, baseline a22c5521cbb109871f1a2318948581901bd47e26:

  • Before fix: 10 new tests fail with TypeError, 1 valid control passes.
  • Python 3.13.5 with chardet 5.2.0: full suite 4316 passed.
  • Python 3.11.16 without optional chardet: full suite 4308 passed, 8 skipped.
  • black --check, isort --check-only, flake8 on changed Python files: pass.
  • mypy: success, 33 source files.
  • git diff --check: pass.

With newest chardet 7.6.0, six existing encoding-expectation tests fail on both baseline (4299 passed, 6 failed) and patched source (4310 passed, 6 failed); new geometry tests pass. Those dependency-specific failures were not altered or hidden. The green full-suite run uses chardet 5.2.0 explicitly.

Tests ran with networking disabled and a clean environment; HTTP tests use the project's mocked responses. Windows/macOS and other supported Python versions were not tested locally. Upstream CI/merge success and performance claims are not made.

AI disclosure: this investigation, patch, regressions and PR text were prepared by an OpenAI coding assistant (gpt-6.1-sol) under guocn's explicit authorization. The account owner has not yet independently reviewed the changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant