Title: Regression of #305 in v0.10.0: disable_numparse=True is ignored when maxcolwidths is set · Issue #428 · astanin/python-tabulate · GitHub
Open Graph Title: Regression of #305 in v0.10.0: disable_numparse=True is ignored when maxcolwidths is set · Issue #428 · astanin/python-tabulate
X Title: Regression of #305 in v0.10.0: disable_numparse=True is ignored when maxcolwidths is set · Issue #428 · astanin/python-tabulate
Description: 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...
Open Graph Description: 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 report...
X Description: 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 report...
Opengraph URL: https://github.com/astanin/python-tabulate/issues/428
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Regression of #305 in v0.10.0: disable_numparse=True is ignored when maxcolwidths is set","articleBody":"*Disclaimer: The following was generated with AI. Bug was originally discovered on BBOT via our CI dependabot: https://github.com/blacklanternsecurity/bbot/pull/3045*\n\nThis 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.\n\n## Symptom\n\nWhen `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.\n\n## Repro (v0.10.0, also present on `master`)\n\n```python\nfrom tabulate import tabulate\ntabulate(\n [['ports', 'str', 'comma-separated port list', '80,443']],\n ['name', 'type', 'desc', 'default'],\n tablefmt='grid',\n disable_numparse=True,\n maxcolwidths=40,\n)\n```\n\nTraceback:\n\n```\nFile \".../tabulate/__init__.py\", line 1705, in _wrap_text_to_colwidths\n else str(_type(cell, numparse)(cell))\nValueError: invalid literal for int() with base 10: '80,443'\n```\n\nOmit `maxcolwidths` and `disable_numparse=True` is honored and the call succeeds.\n\n## Root cause\n\nIn `_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:\n\n```python\nif _isnumber(cell) and numparse:\n new_row.append(cell)\n continue\n```\n\nBut a few lines later it is passed **positionally** into `_type`:\n\n```python\nelse str(_type(cell, numparse)(cell))\n```\n\n`_type`'s signature is:\n\n```python\ndef _type(string, has_invisible=True, numparse=True):\n```\n\nso the `False` lands in the `has_invisible` slot and `numparse` stays at its default `True`. Result: `_type('80,443')` returns `int`, then `int('80,443')` raises.\n\nThis is what PR #362's commit `d29909b` already called out:\n\n> \"calling `_type` is incorrect here; the subsequent lines need a `str`. … This regressed in e8e3091…\"\n\n## How it came back\n\n1. `886e2ed` (Sep 2022) — introduced the buggy `_type(cell, numparse)(cell)` line.\n2. `d29909b` / PR #362 (Mar 2025) — replaced the whole conditional with `casted_cell = str(cell)`. Issue #305 closed as completed on 2025-07-23.\n3. 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.\n\n## Impact\n\nAnyone 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.\n\n## Environment\n\n- tabulate 0.10.0 (also reproduced building from current `master`)\n- Python 3.10 – 3.14 (reproduced on all)\n","author":{"url":"https://github.com/liquidsec","@type":"Person","name":"liquidsec"},"datePublished":"2026-05-12T15:40:33Z","url":"https://github.com/astanin/python-tabulate/issues/428"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bc5aef0c-331d-2409-355d-2a186a3390c1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D2E0:209BD:7931C5:A8E5A1:6AFF3840 |
| html-safe-nonce | e6f8460822782ac819c9a692ad26c6a1d52598c1ec179f12e3d4bdbcef52468a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMkUwOjIwOUJEOjc5MzFDNTpBOEU1QTE6NkFGRjM4NDAiLCJ2aXNpdG9yX2lkIjoiMzQyMzA3NjQxNjg3NzQ0MzEzNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 60d2693ceeb4841918df1f39e4f91b8719b63c3110701963913de5eadc2e3524 |
| hovercard-subject-tag | issue:4430519578 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/astanin/python-tabulate/428/issue_layout |
| twitter:image | https://opengraph.githubassets.com/018dadde8189e87aa34b14118b2028515aa6a839fef049d4f50ae5036732ba3e/astanin/python-tabulate/issues/428 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/018dadde8189e87aa34b14118b2028515aa6a839fef049d4f50ae5036732ba3e/astanin/python-tabulate/issues/428 |
| og:image:alt | 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 report... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | liquidsec |
| hostname | github.com |
| expected-hostname | github.com |
| None | c62a4cffe270f7bba529ed9ad80c801130bd3c78e2633b6731e04c3d4c94463b |
| turbo-cache-control | no-preview |
| go-import | github.com/astanin/python-tabulate git https://github.com/astanin/python-tabulate.git |
| octolytics-dimension-user_id | 71802 |
| octolytics-dimension-user_login | astanin |
| octolytics-dimension-repository_id | 205875548 |
| octolytics-dimension-repository_nwo | astanin/python-tabulate |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 205875548 |
| octolytics-dimension-repository_network_root_nwo | astanin/python-tabulate |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1a7765b21f802bf37d4363105328933cfb777dff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width