You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Disclaimer: The following was generated with AI. Bug was originally discovered on BBOT via our CI dependabot: blacklanternsecurity/bbot#3045
This is a regression. The same bug was previously reported as #305 ("Can not tabulate row with a field that looks like a Python Bool using maxcolwidths"), fixed by PR #362 ("Fix handling 'True'/'False' bool str and None"), merged on 2025-07-23. The buggy code came back in a later merge and is now present on master and in the v0.10.0 release.
Symptom
When disable_numparse=True is combined with maxcolwidths, cells that look number-ish but cannot actually be parsed (e.g. '80,443', a comma-separated port list) crash with ValueError: invalid literal for int() with base 10. The same input works fine without maxcolwidths — disable_numparse=True is honored on the non-wrap code path, but ignored on the wrap path.
File ".../tabulate/__init__.py", line 1705, in _wrap_text_to_colwidths
else str(_type(cell, numparse)(cell))
ValueError: invalid literal for int() with base 10: '80,443'
Omit maxcolwidths and disable_numparse=True is honored and the call succeeds.
Root cause
In _wrap_text_to_colwidths, the per-cell numparse flag is correctly computed (the traceback's locals show numparses = [False, False, False, False] for this call), and it is correctly honored in the first branch:
A subsequent merge brought the old buggy version back (now wrapped in str(...) and reformatted by ruff/black, but functionally the same _type(cell, numparse) call). Master and v0.10.0 both ship the regressed code.
Impact
Anyone passing disable_numparse=True together with maxcolwidths and a string cell that doesn't satisfy _isnumber but is recognized as numeric by _type's default numparse=True (e.g. '80,443', 'True', 'False') will crash. We hit this in BBOT's CLI, which renders module-options tables; '80,443' is a default value for several modules.
Environment
tabulate 0.10.0 (also reproduced building from current master)
Disclaimer: The following was generated with AI. Bug was originally discovered on BBOT via our CI dependabot: blacklanternsecurity/bbot#3045
This is a regression. The same bug was previously reported as #305 ("Can not tabulate row with a field that looks like a Python Bool using maxcolwidths"), fixed by PR #362 ("Fix handling 'True'/'False' bool str and None"), merged on 2025-07-23. The buggy code came back in a later merge and is now present on
masterand in the v0.10.0 release.Symptom
When
disable_numparse=Trueis combined withmaxcolwidths, cells that look number-ish but cannot actually be parsed (e.g.'80,443', a comma-separated port list) crash withValueError: invalid literal for int() with base 10. The same input works fine withoutmaxcolwidths—disable_numparse=Trueis honored on the non-wrap code path, but ignored on the wrap path.Repro (v0.10.0, also present on
master)Traceback:
Omit
maxcolwidthsanddisable_numparse=Trueis honored and the call succeeds.Root cause
In
_wrap_text_to_colwidths, the per-cellnumparseflag is correctly computed (the traceback's locals shownumparses = [False, False, False, False]for this call), and it is correctly honored in the first branch:But a few lines later it is passed positionally into
_type:_type's signature is:so the
Falselands in thehas_invisibleslot andnumparsestays at its defaultTrue. Result:_type('80,443')returnsint, thenint('80,443')raises.This is what PR #362's commit
d29909balready called out:How it came back
886e2ed(Sep 2022) — introduced the buggy_type(cell, numparse)(cell)line.d29909b/ PR Fix handling "True"/"False" bool str and None #362 (Mar 2025) — replaced the whole conditional withcasted_cell = str(cell). Issue Can not tabulate row with a field that looks like a Python Bool using maxcolwidths #305 closed as completed on 2025-07-23.str(...)and reformatted by ruff/black, but functionally the same_type(cell, numparse)call). Master and v0.10.0 both ship the regressed code.Impact
Anyone passing
disable_numparse=Truetogether withmaxcolwidthsand a string cell that doesn't satisfy_isnumberbut is recognized as numeric by_type's defaultnumparse=True(e.g.'80,443','True','False') will crash. We hit this in BBOT's CLI, which renders module-options tables;'80,443'is a default value for several modules.Environment
master)