[BUG] tables.py: Table.identity() raises TypeError on None rh, masking ValueError (4.4.4)

19 views
Skip to first unread message

Georgiy Ishchenko

unread,
Oct 20, 2025, 4:43:40 AM (11 days ago) Oct 20
to reportlab-users
Summary
When a Table triggers a ValueError due to negative availWidth inside _listCellGeom, the error formatting calls Table.identity(), which computes the “tallest row” via int(max(rh)). If rh contains None, this raises a secondary TypeError (int() on NoneType), masking the original and more helpful ValueError.

Affected version
- ReportLab: 4.4.4 (4.4.3 does well)
- Python: 3.13 / 3.14 (reproduced with both)
- OS: macOS

Observed stack (paths redacted)
  File ".../reportlab/platypus/doctemplate.py", line 1170, in multiBuild
    self.build(tempStory, **buildKwds)
  File ".../reportlab/platypus/doctemplate.py", line 1083, in build
    self.handle_flowable(flowables)
  File ".../rst2pdf/createpdf.py", line 836, in handle_flowable
    S = frame.split(f, canv)
  File ".../reportlab/platypus/frames.py", line 235, in split
    r = flowable.split(self._aW, h)
  File ".../rst2pdf/flowables.py", line 408, in split
    _w, _h = first_t.wrap(w, h)
  File ".../reportlab/platypus/tables.py", line 1354, in wrap
    self._calc(availWidth, availHeight)
  File ".../reportlab/platypus/tables.py", line 740, in _calc
    self._calc_height(availHeight,availWidth,W=W)
  File ".../reportlab/platypus/tables.py", line 664, in _calc_height
    dW,t = self._listCellGeom(v,w or self._listValueWidth(v),s)
  File ".../reportlab/platypus/tables.py", line 490, in _listCellGeom
    raise ValueError(f'{self.identity()}: flowable given negative availWidth=...')
  File ".../reportlab/platypus/tables.py", line 440, in identity
    tallest = '(tallest row %d)' % int(max(rh))
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

Notes
- Reproduced via rst2pdf, but the failure is inside ReportLab’s platypus.tables.
- Local paths/usernames were redacted to avoid leaking environment details.
Reply all
Reply to author
Forward
0 new messages