Skip to content

Materialize table header iterables before reading rows - #561

Closed
xiehuanyi wants to merge 1 commit into
mahmoud:masterfrom
xiehuanyi:fix/table-header-iterables
Closed

xiehuanyi wants to merge 1 commit into
mahmoud:masterfrom
xiehuanyi:fix/table-header-iterables

Conversation

@xiehuanyi

Copy link
Copy Markdown

The change

Table.from_data documents headers as an iterable, but a header iterator is consumed by the first row and later raises TypeError when determining the table width. Materialize headers before extracting rows and normalize headers in the direct constructor as well. Requested column order is retained for every row.

Validation: 2 new regressions fail on master and pass with the fix; full suite passes with 680 tests and 12 subtests.

The backstory

Earlier contribution from this account: #555. Found by passing an iterator for the documented iterable headers argument to a two-row table. No separate issue was filed.

AI assistance

  • Harness/tooling: Codex
  • Model(s): GPT-6
  • Original prompt(s): “再改30个10分钟之内可以验证,改正然后提交的issue,提交pr哈。可以多叫几个subagent帮你搞” (Find and fix another 30 issues that can be verified within 10 minutes, and submit PRs; subagents may help.)

Copilot AI balanced review requested due to automatic review settings October 7, 2026 16:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Saadia751 Saadia751 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried one-shot header generators with three namedtuple rows and three dictionary rows, requesting a subset in a different order. Every row uses the same column selection, and the text header agrees. Mutating the original header list after construction also leaves the table's materialized headers intact.

Checked c39d347747a0 with standalone Python 3.12.14 checks (7 passing assertions). I haven't run the full upstream suite.

mahmoud added a commit that referenced this pull request Oct 25, 2026
@mahmoud

mahmoud commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Folded into #609 (see the PR description for credit). Thanks for the report and the repro.

@mahmoud mahmoud closed this Oct 25, 2026
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.

4 participants