From 0083fce54cf91f9337ff6677b1b75d754b61fd26 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Mon, 21 Jan 2019 11:48:18 +0100 Subject: [PATCH] Set default values when guessing columns sizes Fix #770. --- weasyprint/layout/tables.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/weasyprint/layout/tables.py b/weasyprint/layout/tables.py index 7e17183b6..3bdd3bf71 100644 --- a/weasyprint/layout/tables.py +++ b/weasyprint/layout/tables.py @@ -573,6 +573,11 @@ def auto_table_layout(context, box, containing_block): min_content_specified_guess[i] = column_min_content_widths[i] if assignable_width <= sum(max_content_guess): + # Default values shouldn't be used, but we never know. + # See https://github.com/Kozea/WeasyPrint/issues/770 + lower_guess = guesses[0] + upper_guess = guesses[-1] + # We have to work around floating point rounding errors here. # The 1e-9 value comes from PEP 485. for guess in guesses: