Skip to content

Reuse iterator headers for every row in to_records - #1607

Open
FanWu-ai wants to merge 1 commit into
burnash:masterfrom
FanWu-ai:fix/iterable-record-headers-20261006
Open

FanWu-ai wants to merge 1 commit into
burnash:masterfrom
FanWu-ai:fix/iterable-record-headers-20261006

Conversation

@FanWu-ai

@FanWu-ai FanWu-ai commented Oct 6, 2026

Copy link
Copy Markdown

The public to_records utility accepts Iterable headers, but passes the same iterable directly to zip for every row. For a generator or iterator, processing the first row exhausts the keys, so later records become empty. Empty or short rows can also shift remaining header keys onto the wrong values.

Materialize the header iterable once before building the records. The regression uses generator headers and rows, starting with an empty row and a short row before multiple complete records, and verifies both correct column mapping and preserved values.

Validation: baseline complete upstream suite 166 passed; regression fails before the fix (wrong column mapping and empty later records); final complete upstream suite 167 passed with no skips or deselections. Pinned Black 24.8.0, codespell, flake8, isort, pinned mypy 1.11.2, Bandit, source/wheel build, Sphinx -W, pyupgrade and git diff --check passed. Black checked all 18 files returned by its own directory discovery individually because the container blocks its multiprocess manager socket; no sources or checks were omitted.

Local validation used CPython 3.11.16/Linux. The upstream interpreter/platform CI matrix has not been run locally. The advisory pip-audit step did not run successfully; it is configured as non-blocking in CI and is not counted as passed.

Prepared with OpenAI Codex assistance.

@FanWu-ai
FanWu-ai marked this pull request as ready for review October 6, 2026 04:35

This branch has not been deployed

No deployments
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