Skip to content

Honor disable_numparse while wrapping column widths - #471

Open
ShamikOfficial wants to merge 1 commit into
astanin:masterfrom
ShamikOfficial:fix-disable-numparse-wrapping-448
Open

ShamikOfficial wants to merge 1 commit into
astanin:masterfrom
ShamikOfficial:fix-disable-numparse-wrapping-448

Conversation

@ShamikOfficial

Copy link
Copy Markdown

Fixes #448

While wrapping cells, _type(cell, numparse) passed numparse into has_invisible. disable_numparse was therefore ignored, and a value such as 100,120 was parsed as a number.

The flag is now passed as numparse=numparse.

Tested with the new regression test and the existing disable_numparse tests.

The flag was bound to has_invisible, so disable_numparse was ignored for values like 100,120.

Co-authored-by: Cursor <[email protected]>
@killtheprompt

Copy link
Copy Markdown

The keyword argument fixes the disable_numparse=True case. There is still a default-options case from #448 at d3abd94:

from tabulate import tabulate

tabulate([["100,120"]], tablefmt="grid")  # succeeds
tabulate([["100,120"]], tablefmt="grid", maxcolwidths=20)
# ValueError: invalid literal for int() with base 10: '100,120'

Adding disable_numparse=True to the second call now succeeds. Local parametrized checks confirm that distinction; the existing suite also passes (383 passed, 1 skipped, Python 3.13).

Related: #449 already includes a fallback for the conversion failure and tests both settings. If this PR is intentionally limited to honoring disable_numparse, it may help to clarify that scope rather than mark all of #448 as fixed.

Prepared with Codex assistance; the checks above were executed locally against this PR's head.

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.

problem in tabulate 0.10.0 on python 3.11.12 with cell values like "100,120"

2 participants