Skip to content

Grid formats silently drop data rows after multiple separating lines #508

Open

Description

@OnlineBunker

Reproduced on 0.10.0 and current master (268615a), Python 3.12.16/Linux:

from tabulate import SEPARATING_LINE, tabulate

rows = [['A'], SEPARATING_LINE, ['B'], SEPARATING_LINE, ['C'], ['D']]
print(tabulate(rows, tablefmt='grid'))

The output contains A, B and D, but silently drops C. fancy_grid does the same; simple preserves all four data rows.

rowaligns is sized before separators are reinserted. The grid branch then zips it with the longer row list, so iteration ends early. Separator rows also consume alignments intended for data rows.

I checked the open PRs and both pages of separating-line search results. This differs from #328's already-fixed extra-row rendering, #465/#470's index validation, and #452's nongrid alignment path.

I'd like to fix the grid iteration so separators do not consume data-row alignments, with regression tests for row preservation and multiline alignment. AI-assisted investigation and tests.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions